The quickest way is to start qbert, tab, "Input (this game)", and then remap as below:
mame up: joystick up right
mame down: joystick down left
mame left: joystick up left
mame right: joystick down right
There are other ways too, such as using -joystick_map if and only if you joystick is a game controller to windows, but I won't go into that unless you want.