Hey, I *just* got finished fixing this on my own Raspberry Pi 4, Batocera setup, and it even looks like we're using the same brand USB N64 controller! So I hope this helps.
The trick I found was to leave the Mupen64 configuration as default, but manually modify the Batocera "emulationstation" controller configuration. You'll find it in:
\\batocera\share\system\configs\emulationstation\es_input.cfg
In this file, you'll want to look for the controller information. It should be a line that looks like this:
<inputConfig type="joystick" deviceName="SWITCH CO.,LTD. Controller (Dinput)" deviceGUID="03000000632500007505000011010000">
I'm not 100% confident that the device GUID will be identical, but it looks like the SWITCH CO.LTD. part should match your device, given the cfg file you posted above. Anyway, find this section, and replace the controller inputs with this:
<inputConfig type="joystick" deviceName="SWITCH CO.,LTD. Controller (Dinput)" deviceGUID="03000000632500007505000011010000">
<input name="joystick1left" type="axis" id="0" value="-1" code="0" />
<input name="joystick1up" type="axis" id="1" value="-1" code="1" />
<!--A--> <input name="b" type="button" id="1" value="1" code="305" />
<!--B--> <input name="y" type="button" id="2" value="1" code="306" />
<!--C↑--> <input name="joystick2up" type="button" id="9" value="1" code="313" />
<!--C↓--> <input name="joystick2down" type="button" id="0" value="1" code="304" />
<!--C←--> <input name="joystick2left" type="button" id="3" value="1" code="307" />
<!--C→--> <input name="joystick2right" type="button" id="8" value="1" code="312" />
<!--L--> <input name="pageup" type="button" id="4" value="1" code="308" />
<!--R--> <input name="pagedown" type="button" id="5" value="1" code="309" />
<!--Z--> <input name="l2" type="button" id="6" value="1" code="310" />
<!--START--> <input name="start" type="button" id="12" value="1" code="316" />
<!--D↑--> <input name="up" type="hat" id="0" value="1" />
<!--D↓--> <input name="down" type="hat" id="0" value="4" />
<!--D←--> <input name="left" type="hat" id="0" value="8" />
<!--D→--> <input name="right" type="hat" id="0" value="2" />
</inputConfig>
(The stuff in the <!-- --> blocks is not required, I just had that there because it was driving me crazy figuring out all the button id's and codes and how they matched to the controller.)
If you do that, then the default configuration file Batocera gives you for Mupen64 should work perfectly without a hitch. I don't know why the emulationstation frontend GUI doesn't allow you to set the joystick2 to buttons instead of a joystick axis, but as you can see, the raw configuration file supports that option perfectly.
If it turns out your USB N64 controller varies slightly from mine, you should still be able to puzzle out how to get this working by manually adding the correct value and code options to the joystick2down and joystick2right entries. But I'm pretty sure it'll match perfectly.
Hope this helps!
--Richard Winters