Depending on what OS you are using, you can fix this in software. Windows has a utility that allows you to select the direction you want the mouse to use as up. If the mouse is working correctly with the axis simply rotated, you should have no problem getting this working in Windows.
As for MAME, I don't see why you would have any issues at all. MAME lets you map which axis is used for what. So, just map the trackball manually rather than using the built in mapping. Make Up/Down work with the X axis and Left/Right with the Y axis. Done.