I suggest to test
#1. run cmd.exe
#2. cd "B:\Emulators\MAME\MameUI64\"
#3. Mameui64.exe wupndown
It should have same result (fail) in your screenshot.
I cannot say for sure, as I haven't used MAMEUI64, but it should have built-in UI for assigning rom directories whatsoever.
If it does not have setting UI, most MAME releases have mame.ini as their setting file, add following line to the mame.ini
rompath B:\mame151\MAME151roms
Once done, repeat above step #1 through #3. If it succeeds, then it can be also done in AM by your settings. (hopefully)