Alternatively, what comes to my mind, you could remove the attack of the locusts altogether, and add a customized heal ability. I don't know if they will cast it, but if they do, you can set the locust swarm ability to target allies (as previously noted), the attacks will do nothing (so hopefully they just move to allied units), then they can use a short distance heal ability.
If you decide to try this, let us know if it works!