If your AirPods have been in contact with water or any other liquid, you should take them out of your ears right away.
There is no built-in water ejection capacity if you are using normal AirPods (not AirPods Pro). To get rid of water from your AirPods, try the following ways for
water eject airpods.
Shake the AirPods gently to get rid of any extra moisture. Be careful not to shake them too hard as this could result in more damage.
Dry the AirPods' exterior with care with a fresh, dry cloth or towel. Pay close attention to the charging port and speaker grilles.
You can try to absorb the moisture with a cotton swab or a soft, lint-free cloth if water has made its way into the charging port or the speaker grilles.
Give the AirPods at least a few hours to air dry in a cool, dry environment. Before using them once more, make sure they are carefully dry.
You can put the AirPods in a sealed container containing a desiccant, such as silica gel or uncooked rice, if you have access to one. This can aid in absorbing any moisture still present. However, avoid placing the AirPods directly in the desiccant since it could get stuck in small spaces or break things.