really depends on your mods and your weight. Find the hill you like to race up fastest. see what gear it pulls fastest. If that gear feels reved out but it wont pull the next gear--go taller gearing, ie bigger front sprocket or smaller rear.----IF, going up the hill you feel you need a few more reves than change to smaller front or bigger rear sprocket.
Its trial and error to fit your bike and your weight and where you ride.
As a rule of thump on a 500 changing the front sprocket 1 tooth is almost the same as changing the rear 3 teeth. So you can make big jumps with the front and fine tune with the rear.
As sand sucks power, I generally like to be geared lower for the dunes. This makes it easier to pull the next gear, and seldom if ever am I pulling super high top gear speeds in the dunes like I would out desert/trail riding.