A:Answer You need a copy of the game, physical or digital will both work for this. (I am actively doing online with a physical copy.) Please note that you ALSO need a Switch Online membership, which costs 20$ per year for one person, or 34$ per year for 2-8 people. You can also buy the online in 1, 3, and 6 month increments but it's cheaper to buy it by the year. It's worth it for the membership as you get to race against others, and many games including Animal Crossing also have online abilities through the Switch Online membership.
If you don't want online capabilities, you don't need the Switch Online membership, but to race others online at all you will need it.