I've heard that the NSO (Nintendo Switch Online) version on the switch suffers from major input latency. If you haven't Speedrun yet, you may not notice the latency at first, but it is most noticable when swimming or during Bowser throws.
There is also the Super Mario 3D All-stars version on the switch, but in that version BLJs are patched meaning 0, 1, and 16 Star runs are not possible.
The easiest and cheapest way to at least start running this game is with the use of an emulator on PC. Here is a link to the resources page of this site which has a link to the download for the appropriate emulator, Project64 v1.6.1: https://www.speedrun.com/sm64/resources
No it is not allowed to use Nintendo Switch emulators but you can use N64 emulator(Project64)