An immigrant Bosnian city teacher who complained of horrific racial, sexual, and physical abuse from students has settled a lawsuit against the Department of Education, The Post has learned.

Aida Sehic and the DOE agreed to resolve the case this week for an undisclosed but “substantial” sum, according to her attorney, Bryan Glass.

Sehic’s Manhattan federal suit said students in Bronx and Manhattan schools cracked her nose with a bag of metal rulers, stabbed her with a mechanical pencil, routinely demanded sex acts, overturned her classroom and frequently called her a “white bitch.”

Sehic said she repeatedly sought relief from a range of sources, including school administrators, her union and even cops.

But there was little interest in her woes – and Sehic said she was instead targeted for termination because of her complaints and hit with disciplinary charges in 2016.

Sehic’s suit contended that her campus assailants were never removed from class and rarely punished.

Administrators “sought to blame her for unruly classes that resulted from the administration’s failure to protect her and discipline students who were allowed to repeatedly racially and sexually harass her without disciplinary consequences,’’ according to her suit.

After filing her suit in September, Sehic told The Post that she empathized with kids in her classes who were eager to be educated but suffered from the classroom chaos.

“Some kids wanted to learn but there were those who wouldn’t let them,” she said. “You can’t kick the kids out and the administration blames you. What can you do as a teacher?”

Glass told The Post that the city settled her case unusually quickly and that Sehic – who is still a city teacher – was relieved to have put the matter behind her.