How do I deal with all of these snakes?

You don't.

Fountain quaffing is frowned upon as metagaming near-universally because it adds a highly significant element of luck to gameplay. It's a practice closely associated with start scumming, which is the "brute force" approach to NetHack rather than the strategic and measured one.

Although...

Well, if you really want to

disclaimer: I am not responsible for any dirty looks, mocked deaths in the IRC channel, thrown socks or other laundry items, or disgruntled NetHack players breaking into your house that may result from following this advice.

  • Have an escape item. A scroll or wand of teleportation can be used to get yourself out of this situation in a pinch. You can also dig downwards in one turn if you have a wand of digging (you'll have to step off the fountain first, though). There are other similar items listed in the article I linked, but these are the ones you're most likely to come across this early in the game.

  • Prepare beforehand. You mentioned both Wizard and Valkyrie in your question.

    If you're a wizard, you may have started with an identified scroll of taming or spellbook of charm monster, both highly effective against water moccasins, which have no magic resistance. You may have also started with a scroll of scare monster, which can be read to make the snakes flee temporarily or dropped on the ground for a permanent effect, but only on that square (note that if it was uncursed when you picked it up, you won't be able to pick it up again after dropping it!). A spellbook of cause fear is similarly helpful, or you might have a musical instrument, some of which can have a similar scaring effect.

    If you're a valkyrie, your starting inventory probably isn't as useful as the wizard's. However, you do gain intrinsic speed at experience level 7, so it may be prudent to wait until then to quaff from fountains (or indeed use them at all, most notably to dip for Excalibur).

    Note that these tips apply to all player roles, but these specific roles can more easily take advantage of them due to their starting inventories / gained intrinsics.

  • Pre-engrave Elbereth. Engrave the word Elbereth on a square adjacent to the fountain, several squares if possible. Water moccasins respect Elbereth, so they will flee from a player standing on a square with Elbereth engraved. Note that if you're playing 3.6.0, Elbereth's potency is severely weakened; your best option is to use a wand of fire or lightning for a mostly permanent E-square.

It's worth noting that all of these points revolve around one central strategy: run away rather than trying to fight them all at once. Even if the best you can do is to get into a corridor, your chances at survival are vastly higher since only one can attack you at once, rather than all of them if you're surrounded on all sides. Even a corner is better than nothing, since you now only have three neighboring squares instead of, in the worst case, eight.

  • Alternatively, just wait until you're prepared. Although the fountain quaffing effects are less useful later in the game, you still get the chance of increasing your stats or, very rarely, a wish. (My personal advice is still just "never quaff from fountains," but, ya know....)