I'd imagine orders are being prioritized first and foremost by geography. However, the batches they choose to make (MSM, black, etc.) are likely driven off the number of orders in priority geographic regions.
Once the vehicles are built and ready to be assigned, I'd imagine they're being assign based on a weighted combination of delivery center ("fill the truck"), followed by reservation date, followed by order date.
The one exception to this, I imagine, would be the white seats. I've heard they're having trouble sourcing them (and can only get x per week). If there truly is a limited number here, they're going to prioritize higher net vehicles, such as Performance and dual motor. If you can only build x vehicles with white seats before EOY, you're going to build the ones that allow you to book the most revenue + profit.
Showing sustained profit (or Q over Q growth) is Tesla's primary goal at the moment. The easiest way to achieve this? Delivering the most number of vehicles, at the highest net, before Q4 closes.