Why is President Barack Obama inflicting huge political costs on himself to aid the tiny number of Americans who say they’re transgender?

The outgoing President has twice claimed that his very public support of “transgender rights” in 2016 hurt Hillary Clinton by distracting the public from his claimed economic achievements during the disastrous November election.

Yet now he has deliberately distracted Americans from his claim of nefarious Russian Wikileaks hacking in the 2016 election by commuting the sentence of a transgender criminal who provided Wikileaks with its first major data-dump.

The criminal, Chelsea Manning, used to live as a male named Bradley. In 2010, as Obama was trying to reduce the military’s role in the war against jihad, Bradley Manning was posted to Iraq to an intelligence unit. From there, Manning leaked far more vital information via Wikileaks than Wikileaks ever released from hacked computers at the Democratic National Committee or from John Podesta’s email.

Manning was given a 35 year sentence, but Obama has now reduced the penalty so that the former soldier will walk away in May 2017.

The likely reason for Obama’s disastrous pro-transgender policies — before and after the November election — is the influence of gay-advocacy groups on Obama.

He’s a progressive and he sides with their ideological claims — but he’s also a beneficiary of donations from many wealthy gays.

With Obama’s help, the gay groups lobbied the Supreme Court in 2015 to change marriage rules so that states are forced to provide marriage licenses to gays and lesbians.

Now the major gay groups, in lockstep with feminists and other progressives, have set their eye on the next strategic political goal — to destroy what they describe as the sexual “binary.”

That’s their term for the public’s view that humanity is neatly divided into two equal and distinct sexes, except for a small percentage of sexually ambiguous people. For the public, the sexually ambiguous people are too few to require any significant change in civic rules, such as single-sex sports leagues, shower rooms, K-12 schools or child-rearing practices.

That’s a hugely ambitious and very unpopular social-engineering task, partly because 95 percent of the population are heterosexuals, and most celebrate the fundamentally vital task of childrearing — while only one-in-roughly-2,400 Americans want to live as members of the opposite sex.

To make progress on their long-term campaign to raise the social status of homosexuality by lowering the status of heterosexuality, the gay groups rationally pushed Obama to loudly promote pro-transgender rules before the 2016 election, chiefly in North Carolina.

The gay groups, led by the Human Rights Campaign and their liberal business allies, won in North Carolina by unseating the moderate GOP governor in November. But their victory helped shatter the national Democratic Party and the Clinton machine.

Since then, Obama has twice blamed public opposition to his transgender policy for helping Hillary Clinton lose the election.

But he carefully did not blame himself or the gay advocacy groups for the disastrous pro-transgender push in 2016. For example, in mid-December, Obama told NPR that voters “may know less about the work that my administration did on trying to promote collective bargaining or overtime rules. But they know a lot about the controversy around transgender bathrooms.”

In a late December interview with his former political advisor, David Axelrod, Obama complained that media organizations focused too much on his pro-transgender policies:

OBAMA: … I brought up Fox News, but it was Rush Limbaugh and the NRA and there are all these mediators who are interpreting what we do, and if we’re not actually out there like we are during campaigns, then folks in — in a lot of these communities, what they’re hearing is Obama wants to take away my guns…

AXELROD: Right.

OBAMA: Obamacare’s about transgender bathrooms and not my job, Obama is disrespecting my culture and is primarily concerned with coastal elites and minorities. And so — so part of what I’ve struggled with during my presidency and part of what I think I’ll be thinking a lot about after my presidency is how do we work around all these filters?

And it becomes more complicated now that you’ve got social media, where people are getting news that reinforces their biases and — and separates people out instead of bringing them together. It is going to be a challenge, but look, you look at what we did in rural communities, for example…

Having lost the election, partly because of the transgender issue, Obama’s commutation shows that he is still sticking with the gay groups.