A 19-year-old University of Illinois student has been charged with a hate crime for leaving a noose in a residence hall elevator.

Math student Andrew Smith tied the noose with rope he found on the Urbana-Champaign campus, prosecutors said at his arraignment.

It was found in an elevator at 1 a.m. Sunday, with outraged social media posts quickly going viral among students.

The sophomore was busted after a friend who saw him tie the noose reported him to school authorities, Champaign County Assistant State’s Attorney Kristin Alferink told the hearing.

Smith, of Normal, was arrested Monday and charged the next day with felony hate crime and misdemeanor disorderly conduct.

Alferink said Smith told university police that he “only spent about 30 seconds thinking about his actions” and — even after seeing the online outrage — didn’t think it was severe enough to turn himself in.

Smith pleaded not guilty and was released on $5,000 bond, according to the Chicago Tribune. His next hearing is Oct. 22.

“The university does not condone acts of intolerance, bias, or prejudice,” school spokeswoman Robin Kaler said, with students being offered help from support staff if needed.

With Post wires