When is the item I get from a box decided?

Solution 1:

It's decided when you hit the box.

Therefore, you can hit the item button to get the item earlier without affecting what you will get. The only reason I can think of not to press the item button is if you're afraid to overdo it and spam the item by accident.

Unfortunately, I could not find a source for this. The most efficient way for you to test it by yourself (by passing large groups of players) is to use a lightning before a set of itemboxes when being close to group of racers. You could also use a star before a set of itemboxes, then take a shortcut.