We cannot for the life of us understand why two federal judges are so bent on crippling two New York agencies universally seen as at the top of their professions — the Police and Fire departments.

The first is Manhattan federal Judge Shira Scheindlin. She’s overseeing three separate stop-and-frisk lawsuits in which she is signaling her desire to deprive the NYPD of a tactic that’s helped give this city its lowest murder rate in five decades.

Meanwhile, the Fire Department is dealing with a ruling from another federal judge, Nicholas Garaufis.

The FDNY commissioner recently announced that the department will hire nearly 300 minority applicants who took entrance exams back in 1999-2002 but didn’t get jobs because they didn’t score high enough.

The commissioner had no real choice — because Judge Garaufis has repeatedly declared the department’s hiring policies racist, with little proof other than that minority candidates fared poorly on the exams.

Garaufis declared past tests invalid and blocked new tests for four years. This amounted to a job freeze that cost the city $40 million each year in added overtime, until he finally authorized a new class last year.

Here’s another way of putting it: By making himself the Fire Department’s de facto personnel officer, Garaufis forced the FDNY to hire older and objectively less qualified firefighters — with no regard for any effect it might have on morale or public safety.

Oh, yes: This comes after a year in which New York had the fewest fire-related deaths since records were first kept in 1916 — and a seven-year streak of fewer than 100 fire deaths.

The professionalism and efficacy of the NYPD and the FDNY are the envy of the world, with policies and standards that have led to New York’s becoming the safest big city in the country. They — and the city they serve — deserve better than what these two judges are dishing out.