It's hard to prevent, but grooming stones are the best to get rid of them!
I have heard of "fly boots" that I'm hoping to try this summer. They're a flysheet/mesh material that goes just below the knee to the pastern and flies therefore can't land and lay their nasty eggs!
Grooming blocks made of pumice stone , most saddlerys sell them , they are one of the only things that work