For prevention I dilute tea tree with water and spray on the area that has been affected in the past.
clip the hair , to prevent the mud from attaching, then i rub on desatine aka for diaper rash , keeps it dry :)
Equiderma Skin Lotion for horses
my gelding has the same problem! The only way I got his scratches to fully go away was using an anti-bacterial shampoo on his socks once a week, and use a hard brush to get the mud off the legs on the days you don't wash them, hope this helped!