Panalog cream works great. MTG stinks but is good for this crap when used correctly. Sometimes a course of SMZs hits it from the inside. Some people swear by Desinex diaper rash cream while others have custom concoctions.
Its usually a combination of fungus and bacteria, kind of like diaper rash. Don’t pick the scabby stuff off, making it bleed doesn’t help get rid of it but might get you kicked. Keep it clean and dry. Might help to clip the leg hair real close-that seems to really help with both treatment and keeping it gone once clear. Clean and disinfect anything that touches the horse like boots, wraps, brushes and let them dry in the sun.
Vets will tell you it can be a combination of several things and often not related to mud. Ours used to come home from certain barns at a certain show grounds with it every year ( I’ll never tell but starts with a K). Something in the footing or stalls maybe. My mare got it every darn year we went there and got those particular barns. Never had it since she retired.
At any rate, it does NOT always mean bad horse keeping.