The following are requirements to get a one, two, or three star rank.
Get a final score of 53 or above.
Lead most of the laps.
Stay in first place for a good period of time.
Do a lot of tricks on ramps.
Avoid having to use Bullet Bills to catch up.
Use lots of techniques such as wheelies, avoiding POW blocks, etc.
Do not fall off edges too much (one or two times is acceptable). If you get hit by many Spiny Shells and still win, this indicates that you are resistant and will probably have a high rank.
A perfect 60 is required for a Three Star Rank. A two star rank ranges from 55 to 60. A one star rank is 53 to 60 with most or all of these requirements.