Once again, Mayor de Blasio has snatched defeat from the jaws of victory.

In 2007, after a complaint by a group of black firefighters, the Justice Department filed a suit against the city’s fire department. The claim was that the FDNY discriminated against black and Hispanic candidates because they failed the entrance exams at much higher rates than whites.

Most recently, the case had been moving in the FDNY’s direction. Last May, the 2nd Circuit Court of Appeals ruled the federal judge presiding over the case, Nicholas Garaufis, had raised so much doubt about his impartiality that a key part of the case was assigned to another judge.

Even so, the city has now settled. In a deal announced Tuesday, the city agreed to shell out $98 million in back pay, medical benefits and interest to the suing firefighters. The payout comes in the wake of two other decisions in similar lawsuits: the city’s decision to drop an appeal of another federal court’s ruling against the NYPD on stop-and-frisk, and its move to settle the $250 million lawsuit brought by the five men who had their convictions for raping a Central Park jogger in 1989 overturned.

Under this newest surrender, all claims of intentional discrimination — a slander we believe the FDNY would have exposed at trial — will be dropped. The FDNY will hire a chief diversity officer and recruit blacks at a rate approximating their share of the labor market plus 3 percent. Meanwhile, the federal monitor appointed by Judge Garaufis remains in place.

The irony is that this corrects a “bias” that doesn’t exist. The FDNY has already launched its own minority recruitment effort. The result of that effort is that the most recent probationary class for firefighters is 60 percent black or Latino.

But there’s a new team at City Hall. And we can already see the result: activists setting policy for our uniformed services — and a Law Department that serves as an ATM dispensing public funds to plaintiffs.