A knife-wielding hatemonger with a long arrest record has been charged with second-degree attempted murder for stabbing a transgender person’s boyfriend in the back of his neck outside of a Bedford-Stuvesant apartment building while the couple tried to flee the violent homophobic attack.

Emmanuel Dash, 32, was arraigned on Wednesday on 25 counts, which also includes several hate crimes, and is being held on Rikers Island on $40,000 bail.

“I’m trying to stab your f—-t ass,” Dash allegedly yelled at the couple, Diamond Lopez and Neil Ramin, while lunging at them with a knife outside of Lopez’s apartment building on Malcolm X Boulevard.

According to court papers, prior to the slashing, Dash harassed the couple in the early morning hours of June 22 outside of the apartment building. The couple ducked inside — and that’s when Dash went banging on various doors at their building trying to track them down.

“Are you Diamond?” he asked when he got to Lopez’s door. After Lopez answered yes, Dash allegedly said: “I’m glad I know where you live because I don’t like gay people.”

Lopez opened the door, saw that Dash was brandishing a knife and closed the door.

Lopez and Ramin recognized Dash from the neighborhood and decided to go look for the assailant — and that’s when Dash attacked.

Ramin tried to fight off Dash with a stick, and Dash twice plunged his knife into Ramin’s neck, leaving a roughly six-inch stab wound and partially severing his vertebral artery.

Dash was arrested on July 24. He pleaded not guilty to the charges and is due back in court on Oct. 23.

“He vehemently denies the charges and he looks forward to his day in court where he can be vindicated,” said attorney Terence Sweeney, who was appointed to represent Dash. He declined to comment when asked for his client’s version of the incident.

According to police sources, Dash’s arrest for the attack was his 38th since 2003, when he was busted at 16 years old and charged with criminal sex act for pushing a female to the ground, groping her and trying to force her to perform a sex act.

In May, he was charged with allegedly choking his live-in girlfriend at their Bedford-Stuyvesant residence.