I enjoy a good political dust-up as much as the next columnist, but the frenzy of attacks directed at President Biden from both sides regarding his handling of immigration is over the top.

Republicans continue to falsely and cynically accuse Biden of pursuing an “open border” policy. Fox News host Tucker Carlson last week openly embraced white supremacists’ “great replacement” theory, which holds that Biden is trying “to change the racial mix of the country.” Charlie Kirk, a leading pro-Trump activist, accused Biden of deliberately “diminishing and decreasing white demographics in America.”

These accusations are odious and wrong. The decline in the number of White people among the U.S. population has nothing to do with Biden; it is a long-term demographic trend. Biden has hardly stopped border enforcement. Indeed, at the same time that the right is accusing the president of being too lax, he is being assailed by the left for being too restrictive. A centrist policy should make most people happy. In this case, it pleases no one.

Much of the liberal outrage was prompted by viral photos of horse-mounted Border Patrol officers near Del Rio, Tex., trying to prevent Haitian migrants from entering the country. It initially looked as though the agents were using whips to attack Black border-crossers — a horrific image that recalled ugly periods in U.S. history. But, as The Post reported, “Contrary to some reports, the agents in the images were not carrying whips but were seen swinging their horses’ reins. They did not appear to strike anyone.” Indeed, videos of the incident do not look nearly as alarming as the photos.

This is not Trump redux. The previous president carried out inhumane policies such as separating children from their parents, in part, because he wanted to deter more arrivals — but also because, as Adam Serwer of the Atlantic has argued, “the cruelty is the point.” Being beastly to helpless migrants helped to burnish Donald Trump’s brand with his rabidly nativist base.

Biden, by contrast, expressed horror at the way the Border Patrol treated the Haitians. The Department of Homeland Security is investigating what happened. If abuses occurred, they were contrary to the president’s intent — not in compliance with it as under Trump. That’s a big difference.

Biden is being excoriated for returning some of the migrants back to Haiti, which can’t cope with them. But, while 2,000 people have been sent to Haiti, 12,400 people from the Del Rio camp will be able to request asylum status — which usually means they can stay in the United States while their cases are adjudicated. You would never know from all the criticism that far more migrants are being allowed to remain here than are being sent home.

Biden hasn’t yet ended Trump’s pandemic policy of automatically expelling many of the migrants apprehended along the southern border — a senior administration official tells me that was on the verge of happening before the delta variant of the coronavirus hit in July — but he has considerably relaxed it. In July 2020, 92 percent of migrant encounters resulted in expulsion; by July 2021, it was down to 47 percent. Biden has already ended other inhumane Trump policies such as the “Muslim ban” and family separations. Biden just announced that the refugee cap in the next fiscal year will be eight times higher than the one Trump announced in October 2020. Biden has also reduced “inland” deportations by Immigration and Customs Enforcement (ICE) agents far below the level not only under Trump but also under President Barack Obama.

In short, Biden is doing a lot more to make immigration policy humane than progressives who sloganeer about abolishing ICE have ever done. But he gets no credit.

I wish critics would show more appreciation for the difficult balancing act that Biden must pull off. He must treat migrants with dignity and respect while being cognizant that any relaxation of border enforcement will lead to political attacks from the right and serve as an invitation to more arrivals. Indeed, apprehensions at the southern border are at the highest level in 20 years, in part because many people believed Biden would welcome them. Those surging migration numbers, in turn, create controversy that pro-Trump forces can exploit.

Fundamentally, Biden has to balance between those on the right who want to let almost no one in and those on the left who want to let almost everyone in. Is he doing a perfect job? No, but then no president in recent decades has had a great track record on immigration issues. There is simply no perfect solution to the underlying issue: virtually infinite demand around the world to come to the United States but a quite finite willingness on the part of Americans to welcome new arrivals.

Biden is doing the best he can to manage a difficult dilemma with no help from Congress, which hasn’t passed a major immigration bill since 1986. If African American and Latino voters desert the Democrats over this issue, as some activists are threatening to do, they will wind up bringing Republicans back to power — and that, in turn, will lead to far worse policies for immigrants and people of color.