As city schools have gone soft on discipline, students are tormenting each other more than ever — both in person and online, according to a Post analysis of teacher-generated state data.

Staffers flagged a record-high 5,875 incidents of harassment, discrimination and bullying during the 2017-2018 academic year, according to state Education Department statistics.

That’s up more than 300 percent since 2013-2014, when there were 1,344 incidents, and a 60 percent increase from last year, when there were 3,660.

School safety-agent union President Greg Floyd blamed lax discipline — including a dramatic decrease in suspensions — for the soaring numbers.

“Bullies know there are no consequences anymore,” he said. “The kids we are supposed to be protecting are not getting protected.”

Earlier this year, Queens state Sen. Leroy Comrie told state education officials that parents were fleeing his district because bullies were running rampant — and going largely unpunished.

A skyrocketing number of city students are also taking to the Internet to torment their classmates, the figures revealed.

Teachers reported a record number of cyberbullying incidents last school year, 1,242.

That’s up almost 600 percent since the state began collecting cyberbullying data during the 2013-2014 school year, when there were 178 reports.

More than 150 schools had at least 10 incidents of bullying recorded by teachers, the numbers show.

IS 61 in The Bronx had the highest number, with 76, followed by JHS 118, also in The Bronx, with 56.

The Department of Education vowed to redouble its fight against bullying after the shocking classroom murder of a Bronx teen in September 2017.

Abel Cedeno claimed he stabbed two classmates — one, Matthew McCree, fatally — because they bullied him. Their families have denied his account.

The DOE allocated $8 million in additional funding for anti-bullying campaigns soon after the tragic incident.

A department spokeswoman said Thursday that schools with pressing bullying problems have been prioritized and continue to receive ­additional support.

“Although the annual school survey continues to show the overwhelming majority of students feel safe in their schools, we’ll continue our investments to prevent bullying and foster a safe and supportive environment for every child,” said the spokeswoman, Miranda Barbot. “Safety always comes first and we’re making it easier to report and address bullying with more training for staff and a new online reporting form for students and families.”