A New York City man is headed to prison for bursting into a Westchester County college dorm and masturbating in front of a frightened co-ed — who scared him off by pretending to be autistic.

Ariel Caro, 32, was sentenced to 2 1/2 years in state prison for the Sept. 11, 2018 incident at the Pace University campus in Pleasantville, the Westchester County District Attorney’s Office said.

Caro, who was not a student at the school, pushed his way into the victim’s dorm room after she opened the door, thinking it was someone else. The perv then locked the door and blocked her exit.

“At that point, Caro exposed himself and proceeded to masturbate in front of her,” prosecutors said in a release. When he refused to leave, the student “began to repeat a series of expressions, acting, she said, as if she suffered from a form of autism, as she had seen on television.”

“As she got louder, he chose to flee,” the release said.

The freaked out student called her mom, who notified campus police.

Police found Caro — and some drug paraphernalia in a vacant dorm room he had broken into earlier in the night. He was charged with burglary and felony sex abuse.

At his sentencing Monday, prosecutors read a statement from the victim, who said she was so traumatized by the incident that she considered dropping out of college.

“This attack was heinous and the attacker in my opinion is a threat to society,” the statement said. “I hope one day I will feel safe again and not so helpless, a feeling I never had before this horrible attack.”