The two battled head-to-head at a track in Concord, N.C., for a segment on TNT to promote the network's coverage of the Sprint Cup schedule, which begins in June.
"You can imagine how it went," Earnhardt said of the race, without giving away the end result.
Barkley is a studio analyst for TNT and coverage of the race is scheduled to air during the network's coverage of the NBA playoffs.
"I don't want to ruin it, but I would tell you this -- I was really surprised at how nice a guy he was," Earnhardt said of Barkley. "I expected him to be a competition, a little more aggressive just in his personality just knowing what kind of basketball player he was and how he was on the court.
"He was really kind of fiery and aggressive and kind of getting into tussles here and there, but he was just super nice. He just came in and really gracious and really has an appreciation for our sport and just a real nice guy to be around."
Earnhardt posted some photos of the meeting on his Twitter account.
Enjoyed meeting Chuck today. Very nice guy. Not a turrible driver either. pic.twitter.com/Wx0gAOUcx7— Dale Earnhardt Jr. (@DaleJr) May 16, 2014