The gay former Bronx high school student charged with a 2017 fatal classroom stabbing took the stand in his own defense Thursday, taking no responsibility for the violence, and insisting he doesn’t even remember plunging his knife into two classmates.

Instead Abel Cedeno, 19, blamed years of homophobic bullying — and the crowd of kids who’d surrounded him in history class on a Wednesday morning at the East Tremont school, pelting him with pens, balls of paper and punches.

Cedeno is claiming self-defense.

He pulled his switchblade with his right hand from his right pocket on that late September day in hopes that “people would be afraid and not come near me,” Cedeno told the Bronx judge who is presiding over his non-jury manslaughter trial.

But instead of respect, his switchblade was met with taunts by his fellow students at the Urban Assembly School for Wildlife Conservation on Mohegan Avenue, Cedeno testified.

“When I displayed the knife the whole classroom oooed and ahhhed and said, ‘He has a knife!’ ” he told the judge.

That’s when his 15-year-old classmate, Matthew McCree — whose life he’d end moments later with a blade-thrust to the chest — pushed past a teacher who “didn’t do anything,” Cedeno said.

McCree also broke free of another student, “Frankie,” who’d tried to hold him back, Cedeno said.

McCree then charged at him, he said, despite the knife.

“And then Matthew, he was in front of me,” Cedeno said of the boy he was about to kill.

“He punched me in the face. At that moment, I was thinking, ‘This is real,’ ” Cedeno said.

“He punched me in my left cheek two or three times. After he punched me in my face, I proceeded to, like, block the incoming punches” with his left hand, Cedeno said.

But instead of asking next about the moment the blade pierced McCree’s chest, defense lawyer Christopher Lynn jumped ahead in time.

“Did there come a time when the fight with Matthew ended?” the lawyer asked. “Yes,” Cedeno answered.

The lawyer soon circled back to the start of the fight — but only to ask who else Cedeno remembered being punched by.

Cedeno named Ariane LaBoy, then 16 — who’d also suffer a stab to the chest, and live to testify about it.

“I also remember someone hitting me from behind,” so hard, Cedeno stumbled and almost fell to the ground, he remembered.

Afterward, “I remember [a school staffer called “Miss Evelyn”] telling me, ‘Give me the knife.’ I gave it to her,” he said.

“Then I heard a large commotion in the hallway — and someone yell: “Get an ambulance, there is a lot of blood.”

Cedeno, who wore a blue suit with no tie, and whose chin-length hair is died pink and teal, began his testimony by describing himself as suffering bullying from homophobic classmates ever since growing his hair out in fifth grade.

In tenth grade, he would get a haircut and donate the hair to the “Locks of Love” cancer charity, he said.

“Since I had it very long people perceived me to be more feminine and gay,” said Cedeno.

“From the sixth grade I was bullied.

“They called me bitch, they called me f—-t, I’m gay.”

“They pulled my hair. It was so long, I’d fall to the floor, they would kick me.”

He said he was the only openly gay student at Wildlife Conservation.

“You shouldn’t be gay,” he said students taunted him. “Why you acting like that?”

On cross examination, Cedeno insisted he can’t remember switching the knife from his right hand to his left, which is his dominant hand — or even the stabbing itself.

“Well, I remember my arms going up, some of them might have be blocking, some of them might have been punching,” he said. “I know that both of my arms were moving.”