Even on the easiest play level, Space Pirates will attack you as part of a Forced Event.
Dealing with Space Pirates
Is there anything you can do to control Space Pirates? The manual seems to suggest that the AI selects random events according to an algorithm. Maybe failure to develop military forces invites the AI to subject you to random events that require a military response.
If your best ship only attack strength 9 and defense strength 5 but you are suddenly confronted by a Pirate ship with a defense strength of 30?
I suspect there is a solution in the form of Fleet combat and sacrificing multiple ships in an effort to gradually reduce the hit points of the pirate ship. The details of such a strategy would depend on the rate of the pirate ship to repair the damage.
I would suggest you follow many of the suggestions in the Peacekeeper Strategy. One thing I noticed was that the pirates kill all your enemies vessels, forcing them to surrender to you.