I've had a similar issue with collateral damage caused by both fighters and autofiring chaingun/pulse turrets when trying to engage hostile fighters. I suspect that the only answer is to somehow provide the ability to specify rules of engagement, perhaps at some combination of turret, fighter squad, ship and fleet level. These should apply to all fighters, auto-firing weapons on manually operated ships, and all weapons on secondary craft being controlled by their own Captains, at the appropriate level.
The rules of engagement could perhaps be selected from a list like this:
1) Engage hostiles, ignoring potential collateral damage. The current behaviour. Perhaps the new default.
2) Engage hostiles with a weapon if the weapon's boresight vector does not extend to non-hostile entities. Hold fire for a nominal interval then resume boresight checks. Some stray rounds fired whilst turrets are in motion might still be expected to cause collateral damage. Unlucky. War is hell.
Perhaps option2) would be better if more computational effort was expended to avoid any collateral damage, but a simple check of the weapon's current bore-site vector before firing should prevent major reputation loss and facepalming.
Thoughts?