Your in the right spot. ipac is just a keyboard afaik so setup all of your 4player keyboard buttons in the Port1-4 menu (No Core loaded)
Retroarch is based on controllers. So you set your buttons which are fixed per player. You then reassign the emulated console button to already fixed keys per player in the Quick Menu -> Controls section Save Remap.
Be aware of hotkeys, menu keys and emulated cores that accept keyboard by default (MAMECore, Amiga etc)
more info here https://docs.libretro.com/guides/input-and-controls/#keyboard-controls
it’s kinda reversed to most emulators where the emulated system controller is fixed and you click to assign the physical button you have.