Mayfield did not appear at Daytona International Speedway, where he had to enter his team officially to compete for a spot in Saturday's 400-mile Sprint Cup series race.
He was suspended in May by NASCAR after officials said he had tested positive for methamphetamine.
Mayfield has denied using drugs and has sued NASCAR, which has filed a counter-suit.
U.S. District Judge Graham Mullen granted a temporary injunction in Charlotte, N.C., Wednesday allowing Mayfield to race. Mullen ruled that if NASCAR thought Mayfield was a danger to the sport, officials could conduct further drug tests.