Bronx DA Darcel Clark is looking at taking a case all the way to the US Supreme Court, and with excellent reason: New York’s top court is way off base.

Writing for a 5-2 majority, state Court of Appeals Justice Leslie Stein on Tuesday ruled that any undocumented person facing petty but deportable offenses is entitled to a jury trial.

That’s the logic: Committing a federal crime (illegal immigration) entitles you to legal protections in the case of misdemeanor charges — protections US citizens don’t have.

This case involved the 2012 prosecution of Saylor Suazo, an immigrant with an expired visa, for assaulting and harassing the mother of his children. After Bronx prosecutors reduced the charges to class-B misdemeanors that could be resolved at a bench trial, Suazo objected, citing his fear of deportation if convicted. The trial judge disagreed.

On appeal after being found guilty, he lost again: An appellate court found that deportation is merely a “collateral” consequence of conviction — not a criminal conviction itself.

But the Court of Appeals disagreed. In her opinion, Stein worries that deportation is too likely for noncitizens convicted of class-B misdemeanors, citing federal data showing an increase in deportations of noncitizens convicted in state courts since 1996.

On that basis, she declares exposure to federal deportation to be an additional state penalty. But it’s not. A jury trial doesn’t make the deportation peril go away — unless Stein believes that a Bronx jury wouldn’t have convicted Suazo.

DA Clark points out that the decision “conflicts with existing Supreme Court precedent,” which is why she wants the Supremes to address it.

For The Bronx and other areas, this rule only adds to a court backlog that already jeopardizes defendants’ rights to speedy trials and seriously impairs the proper administration of justice.

As important: It’s one thing for legislators to amend laws to shield the undocumented, quite another for judges to give Sixth Amendment rights to noncitizens.

If it takes the nation’s highest court to reverse this lunacy, then that’s where Clark should go.