This is kind of hard given the fact that I'm assuming you're using MV's default movement and not using any plugins to mitigate that limitation. That said, I can tell you that I easily achieved a racing minigame since I'm using Quasi's movement, speedmanager, and a stamina plugin to increase the intensity of the minigame and make it a bit more challenging/exciting, all while giving the npc a set command for his speed/path/etc... without the usage of variables/switches.
(Also, yes, I'm using the NPC as a parallel process.)
The basis of the minigame is to beat the NPC before it reaches the lap 3 times, leaving you plenty of room to modify anything as a developer. It's pretty simple.
I think the easiest way for you to do this with multiple NPC's without lag is to have everything pre-determined and not involve as much switches as possible, then design more levels of difficulty for the next race, which allows more room for customization. On the example below, I had the NPC change speeds at some points, giving the illusion of randomization. This is because you, as a player, will be focusing more on managing your stamina rather than the opponent's progress.
EDIT: I need to add that the whole area is a separate map built just for that one minigame. So, when i said "by making multiple difficulties", I meant, copy/pasting the maps so you won't have to deal with switches. This will increase the game's file-size, but it will reduce as much lag as possible. It's kind of a compromise, really.
Let me know if you need further help.