So this was one of those games that came in a zip lock at the compleat strategist back in the day. I want to say it was a Steve Jackson game because it was basically car wars but with space ships you had ships from frigates to superdreadnaughts that you would build based on ships that has a limited amount of space for propulsion, armor, weapons, shields.
Ogre is the closest game to what you describe that was from Steve Jackson but it involved futuristic ground combat, no ships involved. Otherwise it wasn’t from that publisher.
Starfleet battles? Except you didn’t build your own ships (at least I don’t think so), and it didn’t come in a ziplock bag (as far as I know)
But maybe if you google “games like Starfleet Battles” something may register (I tried but nothing obvious to me)