Black lives matter — unless, apparently, you’re Supreme Court Justice Clarence Thomas. The left is renewing its venomous, racist attacks on Thomas in the aftermath of his dissent in the Supreme Court’s 6-3 ruling in favor of gay marriage.

Actor George Takei smeared Thomas as a “clown in blackface.” The Huffington Post called his dissent “beyond ridiculous” and tarred him as a hypocrite for opposing a court-created “right” to gay marriage:

“Clarence Thomas is married to a white woman — something that would be illegal today, if it weren’t for the Supreme Court’s historic Loving v. Virginia ruling.” As if his personal life is fair game.

Last Friday, in another low blow, New York Times reporter Adam Liptak portrayed Thomas as a lightweight whose opinions are cut-and-paste jobs from briefs submitted to the court.

But in truth, all the justices refer liberally to briefs. Thomas borrows about 11.3 percent of his judicial prose from briefs, but Justice Sonia Sotomayor lifts 11 percent and Justice Ruth Bader Ginsburg 10.5 percent. It’s not “cribbing” or plagiarism, as Liptak’s hatchet job implies, but simply the way decisions are written.

In fact, Thomas appears to be the most productive justice, having written 37 opinions this past term, more than any other justice. That fact’s enough to dispense with New Yorker writer Jeffrey Toobin’s bogus claim that Thomas has “checked out” and “is simply not doing his job.”

The trigger for these latest attacks is Thomas’ view that the legality of gay marriage should be decided by state legislatures rather than enshrined as a right by the Supreme Court.

Thomas is no homophobe. In 2003, when the court struck down a Texas ban on same-sex sodomy, Thomas expressed his personal disagreement with the law, calling it “uncommonly silly.” He said “if I were a member of the Texas Legislature, I would vote to repeal it.” But he explained that it was up to the Legislature, not the court, to right that wrong.

That’s the same argument he made in Obergefell, the gay-marriage case decided in June. The court’s majority ruled that same-sex marriage is a “right” protected by the Constitution’s guarantee of due process.

But Thomas, and many conservative jurists, worry that judges have turned due process into a vehicle for inventing rights from the bench. Thomas warns that “treating the Due Process Clause as a font for substantive rights” allows judges to make policy, instead of waiting for legislatures to do it.

You can disagree with that reasoning, but Thomas is anything but a lightweight.

His life proves that. Thomas was born in 1948 to a family that spoke only Gullah, an Afro-English dialect. He grew up in the South in a rural shack without plumbing, and yet made his way through Holy Cross College and then Yale Law School. By comparison, President Obama was a silver-spoon baby.

When Thomas was nominated to the Supreme Court in 1991, the left attacked him, largely because he had already taken stands as an appeals-court judge against judicial activism and affirmative action.

Columnist Maureen Dowd said she was “disgusted at someone who could benefit so much from affirmative action and then pull up the ladder after himself.” But Thomas had learned the hard way that affirmative action can hurt recipients. After Yale Law School, prestigious law firms didn’t want to hire him because they assumed he hadn’t really done the work.

During confirmation hearings, Thomas fended off hostile questions about accusations of sexual improprieties with Anita Hill, and his insistence that upholding the Constitution is better than adhering to precedents that violate it.

Twenty-five years later, the mean-spirited attacks continue. But at age 67, Thomas isn’t likely to leave the bench anytime soon. Of course, the Obergefell decision is also probably here to stay. Few people will worry about the weak legal scaffolding on which it was built.

Most Americans care about outcomes, not process. But they should recognize Thomas’ important role in defending the Constitution. That is his duty as a judge.

Betsy McCaughey is author of “Government by Choice: Inventing the United States Constitution.”