In this Oct. 7, 2007, file photo, a Confederate flags fly in the infield as cars come out of turn one during a NASCAR auto race at Talladega Superspeedway in Talladega, Ala. (Rob Carr/ASSOCIATED PRESS)

For four years, Josh Newman, now a professor of sport management at Florida State, visited NASCAR races all over the country for a book he was writing on consumerism and the multibillion-dollar stockcar circuit. And he was struck by how NASCAR couldn’t help but speak out of both sides of its mouth.

On one hand, it stated — as it reiterated Tuesday in the wake of the arrest of a Confederate flag-waving white man for the massacre of nine black Charleston, S.C., parishioners in their church — that it “disallow[ed] the use of the Confederate flag symbol in any official NASCAR capacity.”

On the other hand, Newman said he and his co-author, another Florida State professor, Michael Giardina, “kept seeing these vendors that still were selling some pretty awful things in terms of racial politics. These are people who buy the space to vend from NASCAR . . . selling all these Confederate flags. So it’s interesting that [NASCAR takes] a position like that, but if you look at where a lot of their money comes from, it comes from these merchandisers.”

It was a reminder to me of something I’ve long thought, since supporting movements to ban the Confederate flags at Texas high schools in the ’90s when I lived and worked there: There may not be a corner of our society that has done more to popularize, and somehow normalize, through marketing and commoditization, the public displaying of the Confederate flag and its subsequent imagery than the world of sports. Sports all but granted sanctuary to this affront to sensibility.

“There’s no place where the focus is so centrally located on the body [as sports], so what you see is this ability of certain sports entities to draw these strong connections between these symbols — Confederate flags and bodies — whether the bodies are in the stands or . . . on the middle of the field,” said Newman, whose book “Sport, Spectacle, and NASCAR Nation: Consumption and the Cultural Politics of Neoliberalism” was published in 2011.

And it isn’t just sports most popular in the Bible Belt, such as NASCAR or Southeastern Conference college football, where the Confederacy was killed 150 years ago and the apartheid America it birthed was exterminated by law half a century back.

There’s a high school on the shores of Lake Erie in LeBron James’s northeast Ohio — Willoughby South — whose mascot is a rebel soldier and whose athletes, WEWS Channel 5 in Cleveland reported Thursday, sometimes sport the Confederate flag embroidered on their letterman jackets even though they are not allowed to wear the banner in school.

The flag is on the General Lee (as in Confederate General Robert E.) car from the old TV show “The Dukes of Hazzard” that golfer Bubba Watson, a two-time Masters winner, drove to the 2012 Phoenix Open shortly after buying it at a car auction that January. He exhibits it around the country, though NASCAR told him don’t bring it to its events. Just the good ol’ boys; never meanin’ no harm . . .

All of this is a reminder that many of us sports journalists have constructed a mythology about the games we love: that they’ve been in the vanguard of social change in this country.

Last year, Michael Sam’s coming out before the NFL draft was hailed by some as a landmark moment. But the rest of society had elected, appointed as corporate executives and government officials or worked and lived with gay and lesbian people for generations.

And there is the biggest myth of all: that Jackie Robinson’s acceptance of Major League Baseball’s invitation to reintegrate its diamonds (Fleetwood Walker was the first black major leaguer between May and September 1884) was a seminal moment in the Civil Rights movement. Truth is, Robinson was part of a continuum in the 1940s. He was preceded by President Roosevelt’s executive order in 1941 that prohibited racial discrimination by federal defense contractors, a Supreme Court decision in 1944 that outlawed all-white primaries and a Supreme Court ruling in 1946 that ruled segregated seating on interstate buses was unconstitutional.

The power of sports could have been a leader against the ugly imagery of the Confederate flag long ago. It could have moved to eradicate it.

But the NCAA, that governing body for institutions of higher learning, didn’t take action against South Carolina’s flying of the Confederate flag until shamed into doing so in 2001 after the NAACP approved a tourism boycott against South Carolina until the state stopped flying the flag on its Capitol.

In 1982, Ole Miss could have supported its first black cheerleader, who refused the tradition of toting the Confederate flag at games, but instead the school gave into pressure from alums, fans and the KKK and continued the tradition for years afterward. John Hawkins, the cheerleader, decided not to try out for the squad after that one season.

The public school district that oversees Hays High School in central Texas didn’t have to wait until 2012, four years after the country elected its first African American as president, to ban the Confederate flag from school property and events.

But sports haven’t been the societal trendsetter some among us have made them out to be. They’ve often been laggards, as with this Confederate flag mistake, and duplicitously so.

Kevin B. Blackistone, ESPN panelist and visiting professor at the Philip Merrill College of Journalism at the University of Maryland, writes sports commentary for The Post.