Detailers use air compressors with blow gun tips to get dirt off the engine and parts first before using any wet rags. I used that trick to get Kansas Brown and Texas
Red dirt out of my truck engine bay and truck bed.
If you keep the bay clean since the day you bought it new, its not much trouble to clean unless you take the 'Stang places that trucks should be going to instead.
If the engine is older with grease/oil you need to cover area up with baggies that don't like water. Keep water out of electronics. Use a non-corrosive cleaner spray and use lower pressure water spray if you can. Let the engine dry or blow dry it before trying to start it.
Then of course there were the 70s and 80s when user car dealers steam cleaned motors. Probably still happening today as well.