The city is making a major push to sweep the streets of dangerous, mentally ill New Yorkers — and has even compiled a most-wanted list, The Post has learned.

The measure follows a pair of high-profile subway-shove fatalities from December allegedly involving mentally ill individuals.

The city has already drawn up a list of 25 targets, sources said.

“After the Queens subway attack [of immigrant Sunando Sen], the [city] decided to take a proactive approach to track down the most dangerous mental-health patients that currently have mental-hygiene warrants” out for them, a law-enforcement source said.

Those warrants mean that the patients are not wanted for a crime but instead are being sought because they are not getting their court-ordered treatment.

There are a handful of cops assigned to the detail, which began working in the past few weeks, the source said.

Cops in the NYPD’s Real Time Crime Center are using high-tech methods to first track down the individuals, and detectives on the street have been assigned to then go after them and take them to hospitals, law-enforcement sources said.

In the past, the city Department of Health would ask cops for help finding mentally ill people who aren’t taking their court-mandated meds so they could be taken to clinics. But that only applied to those who had known addresses — and patients who went off the grid were rarely pursued, the sources said.

The city is now concerned it could be liable if one of those people goes off the rails and hurts someone — or themselves, the sources said.

And that’s prompted the Health Department to seek more help from the NYPD. These patients could, of course, be dangerous, health officials noted.

Now, “you have a family member who goes to the Department of Health and gives them the information. Then they go to the Police Department, and together, the DOH person and the police go out and try to track down these people,” said a city official. “They’re just trying to get these people help.”

“All of these patients are receiving treatment for mental-health conditions,” said Department of Health spokesman Sam Miller. “If they do not receive sustained treatment . . . they could pose some risk to themselves, family members or others.”

But tracking them down won’t be easy. “There’s no rhyme or reason to their craziness,” said a law-enforcement source.

“You might find yourself looking all over the place for one of these kooks who rides the subway back and forth.”Such craziness includes homeless man Naeem Davis’ alleged Dec. 3 fatal subway push of a Queens father — Davis has claimed voices guided his deadly act — and the horrifying shove of Sen allegedly by accused Muslim-hating maniac Erika Menendez.

Menendez told The Post in a rambling jailhouse interview that she likely would not have killed the hard-working man had she smoked weed that day — she uses it to self-medicate for bipolar disorder.

She also has allegedly told authorities that she killed Sen, a Hindu, because of 9/11 — not because so many people died, but because of the destruction of the buildings.

She has been found fit to stand trial.

Additional reporting by Josh Margolin and Dan MacLeod