Zeldin was unhurt and his attacker arrested.
"His words as he tried to stab me a few hours ago were 'you’re done'," the Republican politician tweeted, thanking attendees including fellow politician Alison Esposito for help.
"I'm ok ... fortunately, I was able to grab his wrist and stop him for a few moments until others tackled him."
Monroe County Sheriff’s Office identified the suspect as David Jakubonis, 43, of Fairport. The motive was unclear.
Video footage posted on social media by witnesses showed a man wearing a black baseball cap quickly approach Zeldin from the side of the stage at the rally in upstate New York.
Zeldin pushed the suspect away before both men tumbled to the ground as several others tried to subdue the suspect.
"Political scores should be settled at the ballot box, not on stage at campaign events trying to violently attack candidates you disagree with. This is not ok," said Zeldin, who represents New York’s 1st Congressional District.
Jakubonis, who is charged with second degree attempted assault, had a weapon in his hand and swung it towards Zeldin's neck, the sheriff's office said in a statement.
Members of the audience and Zeldin's campaign team restrained Jakubonis until deputies arrived and took him into custody, the statement added. The suspect was arraigned in Perinton Town Court and released on his own recognizance.
A spokesperson for Zeldin's campaign, Katie Vincentz, said Zeldin finished his speech following the incident and thanked law enforcement officers who responded to the attack.
"Relieved to hear that Congressman Zeldin was not injured and that the suspect is in custody," tweeted incumbent New York Governor Kathy Hochul, a Democrat and Zeldin's opponent in the race.
"I condemn this violent behavior in the strongest terms possible — it has no place in New York," Hochul said.