Defender had a funky control setup, the joystick was 2 directional Up & Down and buttons for Thrust, Reverse, Fire, Smart Bomb and Hyperspace. The reverse button turned your ship around and you pressed thrust to move in the direction you were facing. You may be able to trick Mame into thinking that left and right on your controller is both reverse and thrust, I will tinker with this and see what I can figure out.
Edit: I did a little bit of tinkering to try and trick Mames controls into something a little more user friendly but sadly there was nothing I could do that was perfect or even really good. The best I can tell you to do is while in game press "Tab" to bring up the Mame menu and the Controls (This Machine) and try and rebind some of the stuff for that game to your liking.
Star Trek SOS looks like it used a "Spinner" control so you will need to configure your controls in Mame to map your joystick to the left and right spinning. This is not ideal but it can be made to work but your mileage may vary with how well it does it.