President Trump welcomed 2017 NASCAR Cup Series winner Martin Truex Jr. to the White House Monday, and while the nation’s commander in chief had plenty of praise for the first-time champion and stock-car racing in general, he couldn’t resist the opportunity to take a thinly veiled jab at other athletes and sports leagues he’s previously sharply criticized.

Trump praised NASCAR as having a culture in which “they …  stand for the playing of the national anthem,” alluding to his attacks on NFL players who have knelt or made other demonstrations during the anthem to draw attention to issues of racial injustice.

“This lively sport reflects our national spirit and our can-do attitude,” Trump said during a ceremony on the South Lawn of the White House. “At every NASCAR race, you will see thousands of patriotic Americans, from the grandstands to the pit stalls, proudly waving our flag and roaring with joy at the words, ‘Start your engines.’ ”

Trump then looked up from reading his prepared remarks and motioned toward NASCAR CEO Brian France. “And I will tell you — one thing I know about NASCAR, they do indeed, Brian, stand for the playing of the national anthem, right?” Trump said, to cheers and applause.

“They do indeed,” the president continued. “Somebody said, ‘Maybe you shouldn’t say that, that’ll be controversial.’ I said, ‘That’s okay, NASCAR’s not going to mind it at all.’ Right, fellows? They don’t mind it at all.”

During his campaign for the presidency, Trump singled out Colin Kaepernick for criticism, after the then-49ers quarterback began sitting and kneeling during pregame renditions of the anthem. In August 2016, the GOP nominee said of Kaepernick, “Maybe he should find a country that works better for him. Let him try. It won’t happen.”

Kaepernick quickly inspired some other NFL players — as well as athletes in other sports and at other levels of football — to emulate his example, and Trump expanded his criticisms to include the likes of Raiders running back Marshawn Lynch. In September 2017, at a rally in Alabama, Trump used the phrase “son of a bitch” while calling for NFL owners to “fire” protesting players, leading to widespread demonstrations, some of which included team owners, before Week 3 games.

Around that time, NASCAR legend Richard Petty and another prominent Cup team owner, Richard Childress, said that they would not tolerate any protests by members of their organizations. During Trump’s run for the presidency, France and several NASCAR drivers appeared at a campaign event, offering their endorsements just before the Super Tuesday primaries, many of which were held in Southern states.

“You know about his winning in business, and success,” France said then of Trump. “I’m here to tell you, he wins with his family. … That’s how I judge a winner. How somebody manages their family, raises their family.”

Trump returned the praise at the time, then said of France at Monday’s event: “He is doing a fantastic job. I’ve had him as my friend for a long time, Martin. You wouldn’t believe that. Right? Different sides, different states, slightly. But we liked each other right from the beginning.”

“NASCAR grew from the back roads of America’s South and the bright shores of Daytona Beach — incredible place — to become one of the world’s premier and most beloved sports,” Trump told his White House audience. “I love it, people love that sport.”

Of Truex and his Furniture Row Racing squad, Trump said: “This incredible NASCAR team bonded through tragedy, drew closer together, and willed themselves on to the title. The motto was, ‘Never give up.’ I’ve heard that motto before. That’s a great motto. You don’t lose with that motto.”

Trump has invited the Super Bowl champion Eagles to visit the White House on June 5, but Philadelphia safety Malcolm Jenkins, who frequently raised his fist during the anthem, said last week that while “some guys have dreamed” of making the traditional trip by NFL title winners, “There’s also a lot of guys who feel passionate about not going.” Last month, the New York Times published comments from an October NFL meeting during which Eagles owner Jeffrey Lurie said that many of his fellow owners “have no interest in supporting President Trump,” who he said had authored “one [expletive] disastrous presidency.”

A video of Monday’s event posted by the White House omitted Trump’s comments about the anthem.

Read more from The Post: