I don't see why you would need joytokey for attractmode itself but if you do you could launch attractmode using a batch file that first calls joytokey and then attractmode. If you do launch joy2key with attractmode you can use the "Associate profiles to target applications" feature of joytokey to assign different profiles for different emulators as described near the bottom of this page
https://joytokey.net/en/overview.
If you don't launch joy2key with attractmode (or even if you do) you can launch joytokey when you run your emulator and define the profile you want to load.
Example of existing emulator without joytokey:
# Generated by Attract-Mode v2.4.1
#
executable \Emulators\MAME\mame64.exe
args [name]
Example of the same emulator running joytokey with a specific profile
# Generated by Attract-Mode v2.4.1
#
executable \JoyToKey\JoyToKey.exe mameprofile;\Emulators\MAME\mame64.exe
args [name]