It would be helpful if you specified which emulator you are using. See this page:
https://github.com/RetroPie/RetroPie-Setup/wiki/FinalBurn-Alpha
If it’s pifba, then switch the 0 and 1 under the joystick axis options in fba2x.cfg… If that doesn’t work try making one or both negative.