Work, repetition and patience. Just like any other desensitization training. It's all about the timing of the release. You always start at the smallest possible baby-step, set them up for success. Apply the stimulus, and release when you get a relaxed response (like licking lips/chewing, blinking, cocking a leg, relaxing the ears, lowering the head). The important part is to not discontinue the stimulus until you get the relaxed response. If they freak out too much, it's because you took too large of a step, and need to break it down into smaller steps.
So, applying this to bathing, you start with the smallest possible step. For some horses, it's walking to the hose and simply turning it on. When they relax, you turn it off, giving them the release. Then you work up to spraying the hose at something 15 feet from them, again, when they relax, cease the stimulus. Soon they learn that if they want it to stop, they only need to relax. If you stop while they are flipping out, you teach them to flip out in order to get it to stop. Make sense?