Mr. Anderson, who worked at West High School for three years and East High School in Madison for eight years before that, said the episode started when an assistant principal radioed for help with a disruptive student.

The student, a 17-year-old senior, had finished classes for the day and had taken another student’s cellphone when the assistant principal intervened, according to Mr. Anderson, who said the student then pushed the assistant principal.

As Mr. Anderson was trying to escort the student out of the building, he said, the student taunted him with the racial slur about 15 times. He said he repeatedly told the student to stop using the slur, which he himself repeated several times.

That’s when he said the assistant principal, Jennifer Talarczyk, turned on the microphone of her walkie-talkie, so that Mr. Anderson could be overheard by school administrators and members of the security staff. He said Ms. Talarczyk told him to “tap out” and remove himself from the confrontation with the student.

“I’m not going to be called that word,” Mr. Anderson said in the interview. “I have a right to not be called that word, I believe. I feel like she tolerated it for the entire ordeal.”

Ms. Talarczyk did not immediately respond to a request for comment.

Two days after the exchange, Mr. Anderson said he was put on notice by the school’s principal, Karen Boran.

He said Dr. Boran told him he was “going to have an uphill battle” and that he was “going to have to fight politics.”