A Harlem man has admitted to attacking a woman in December and hurling homophobic slurs at her as she exited an E train in Queens because he believed that she was a homosexual.

Allasheed Allah, 54, pleaded guilty on Wednesday to one count of third-degree assault as a hate crime, according to a release from the Queens District Attorney’s Office.

Criminal Court Judge Mary Bejarano indicated that she will give Allah a one-to-three-year prison term on Nov. 7 when he comes back to court for sentencing.

According to the release, on Nov. 20, Allah argued with the 20-year-old victim at the 71st Street stop in Forest Hills on a Manhattan-bound E train when he saw the victim’s female friend kiss her on the cheek.

“Kiss her again you d–e bitch!” Allah shouted at the pair, the release states.

The women left the train, but Allah followed them. He then struck the victim in the head and chest, causing her to collide with both a nearby pole and the floor. The victim has since recovered from the injury, the DA says.

Allah fled the scene but was busted days later thanks to a tipster.

“This kind of hate-inspired assault is intolerable and we won’t stand for it here in Queens County – the most diverse county in the country,” Acting DA John Ryan said in a news release. “The defendant will go to prison as a result of this vicious attack.”

Allah’s attorney did not immediately respond to a request for comment.