An upstate jihadist acting under the direction of an overseas ISIS terrorist was busted by the feds a day before he planned to hack up New Year’s Eve revelers at a Rochester restaurant, officials said Thursday.

Emanuel Lutchman, 25, collared in an FBI sting involving three paid informants, was charged with attempting to provide material support to ISIS, according to a criminal complaint.

The “self-professed Muslim convert” claimed to have received instructions from an ISIS operative to unleash the machete mayhem at a bar-restaurant in the Rochester area.

He had no money, so one of the informants, pretending to be an accomplice, paid $40 at a Walmart to buy a machete, knives, ski masks, duct tape, ammonia, latex gloves and plastic ties, the complaint said.

Lutchman has a rap sheet dating back to 2006, when he was convicted of robbery.

The jihadi wannabe had been talking with the three confidential sources since November. Some of the conversations were recorded.

Lutchman “expressed his hatred for everything in America and his intention to make hijra [migration] and leave America,” the complaint said.

In recent days, he told an informant that he had communicated with an ISIS “brother” in Syria who told him that being in the group was “a dream come true,” the complaint said.

Lutchman told the informant that the ISIS thug told him he’d have to prove his allegiance to the group by praying regularly and planning a New Year’s Eve “operation,” the FBI said.

“New Year’s is here soon. Do operations and kill some kuffar [infidels],” the extremist told him.

“That’s what my plan, that’s on my mind, that’s all I been thinking about,” Lutcghman allegedly replied. “I’m getting amped up, to accept the fact that’s what I gotta do — ’cause I want to make hijra.”

On Wednesday, the feds arrested Lutchman in a car and recovered a cellphone video in which he swore allegiance to ISIS leader Abu Bakr al-Baghdadi and claimed responsibility for the planned attack, they said.

Additional reporting by Kirstan Conley