A hate-spewing straphanger who pushed a subway rider to his death because she thought he was Muslim was sentenced to 24 years in prison Wednesday by a judge who called the victim’s death a “horrible way to die.”

Erika Menendez, 33, who had copped a plea to manslaughter, insisted she couldn’t remember her motive for shoving Sunando Sen, 46, off a Queens subway platform to his death in 2012.

Queens Judge Gregory Lasak expressed his outrage over Sen’s death before sentencing Menendez.

“For whatever reason, when you gave your statement to police after you were arrested, you said, ‘I hate Muslims and the Hindus.’ Do you remember that?” Menendez said, “No.”

“You picked out Mr. Sen, who was on that platform and you stood behind him and you followed him. This was a particularly brutal homicide. I can only imagine his final thoughts. That’s ahorrible, horrible way to die.”

Lasak said Menendez’s act terrorized the whole city.

“Millions of people take the trains every day in New York City to go to work or to go to school or other destinations, and they want to feel safe,” Lasak said. “And this put a chilling effect on all the ridership.”

Menendez was seen talking to herself and pacing back and forth on the subway platform of the 40th Street-Lowery Street station in Sunnyside at around 8 p.m. Dec. 27, 2012, at the same time Sen was on the platform waiting for a No. 7 train.

As the train pulled in, Menendez approached Sen from behind and shoved him onto the tracks.

“The defendant committed what is every subway commuter’s worst nightmare — being suddenly and senselessly pushed into the path of an oncoming train,” said Queens DA Richard Brown.

Just two months ago, while accepting a plea deal, Menendez repeated her shocking motive when the judge asked why she pushed Sen.

“ ’Cause I don’t like Muslims,” said Menendez, echoing what she had told The Post in an exclusive jailhouse interview after the attack.

“I just wanted to hurt Muslims and Hindus ever since [9/11] . . . I’ve been beating up Muslims and Hindus for a long time,” she had said.

Sen was from Calcutta, India, and was Hindu. He co-owned a printing shop in Washington Heights.

Prosecutors chided the defense for trying to blame a faulty mental-health system for Menendez’s evil act.

“She didn’t do her part,” said Assistant District Attorney Peter Lomp.

“Instead of taking her medications she should have taken, she was off smoking weed as much as she could and as often as she could.”