As far as I know this is for your driving performance individually as well as in relationship to your race. It's not related to your points or how many times you got first. You need to do tricks on jumps, drift through turns, and most likely your item useage and hit percentage. I'm sure it takes into account the hits you take as well. You might try driving in 2nd or so place most of the race so you avoid rubberband ai such as blue shells. That probably will get you some star ratings. Good luck!