Taken from Alternatives for animals forum
"Leaving an onion sliced in half in the stall helps to keep flies away...in the stalls at least - I certainly wouldn't recommend you put onion actually on your horse!!"
And
"African Marigolds planted around the barn - inside in hanging baskets also works well as long as the horses can't get to them! - helps to repel flies"