I'm not familiar with ketoconazole, so I Googled it. As usual, this time of day I have trouble opening links as it's the right time for the entire Western Hemisphere to be on-line, but I did see enough to know that is a really high dose drug.
You've taken care of the worming, the vet's involved, so my first thought is diet, including what type of forage this horse eats. Surprisingly diet can play a huge huge role in controlling these sorts of issues.
I have a horse with food intolerances and environmental allergies. Mention scratches and rainrot in front of him and has them
I've got him under control by about 98%, even in this gawd-awful heat we are experiencing. With the humidity now starting to climb, it ups his chances of Scratches a lot more than rain rot.
What I did:
1. He comes in every night. I put grid mats, on top of several inches of limestone crush, in his stall so the urine stays off his shavings longer (his own urine definitely aggravates the scratches issues).
While I clean manure every single day, I change his shavings about every three days and that helps. Buy clean, good quality shavings as that can also make a difference, if your horse is stalled part of the time. I buy Calloway shavings.
2. While I cold-hose him down and take a brush to him every couple days, I only shampoo him once a month. I'm afraid of depleting his natural oils.
I use MalAcetic. I swear by this stuff for the horse and the dogs. It is all natural and has a very soothing affect on everyone I use it on. "DermaPet" MalAcetic Shampoo for Dogs and Cats (ONE GALLON)
I bought a gallon two years ago and still have 2/3'rds of it left. A little of this stuff goes a long way unless you have really hard well water.
I will wash his legs a lot more frequently with Dawn Dish soap. It doesn't dry his legs out but I still wouldn't want to use it on his entire body.
Just make sure you have enough towels to dry the legs off really well.
3. After all that hoo-ha, if you can afford Vetericyn, buy a couple of the big bottles; I prefer the pure liquid over the gel but I'll take what I can, if I'm out
Again, a little of this goes a long way. After washing your horse down, I would spray the Vetericyn on the affected areas (including the back) and gently massage it in.
It's not goopy, won't cause your horse to sunburn, and also has a comforting affect.
4. Also, just for kicks, have you had your pastures and hay tested? If either or both happen to be high in iron, that means they're deficient in copper and zinc. Both of which are critical to the immune system and the immune system is what keeps these fungal and bacterial issues from becoming chronic.
My 25 yo TWH never had any sort of fungal/bacterial issues until he developed Equine Metabolic Syndrome five years ago. Now he deals with them because his immune system has been compromised by the EMS and my pastures & hay are also very high in iron. He's not as bad as the horse I described to you but I still have to watch him close.
I don't know if any of this will help you but it's worth a try