In December, a classmate’s parent overheard Leo say that somebody “drinks out of my penis,” according to the complaint. The parent asked Leo if he was talking about his dog, and he said: “No, I mean my mom. My parents eat my poop.” The complaint said that the parent understood this to be a joke, a 5-year-old trying to get a rise out of his friends. Nonetheless, she mentioned it to the classroom teacher, Sheri Silverstein. Ms. Silverstein asked Leo’s mother to speak with him about it.

Five days later, Ms. Litwack, the principal, called Leo’s parents and told them to come in for a meeting. She said that the comment indicated that Leo was “disturbed,” according to the complaint, and that he needed therapy.

A few days later, Ms. Litwack was instructed by her district superintendent, Anita Skop, to report Ms. Super to the state. Police officers arrived at the family’s home around midnight, followed by officials from the Administration for Children’s Services. Toya Holness, a spokeswoman for the Department of Education, said in a statement that school employees have no choice but to report anything suspicious.

“Schools must be welcoming and nurturing places, and we provide training and resources to ensure students and staff attend school in a safe, supportive and inclusive learning environments,” Ms. Holness said. “D.O.E. staff members are mandated reporters and have a legal obligation to refer any suspicion of child abuse, maltreatment or neglect for investigation.”

Ms. Holness declined to address specific concerns about how the staff at P.S. 107 welcomed Leo or introduced him to his peers, citing the pending litigation. A spokeswoman for the city’s Law Department said it was reviewing the lawsuit.

But the family’s lawyer, Allegra L. Fishel, founder of the Gender Equality Law Center, said that the school viewed the comment as suspicious in the first place because of Leo’s everyday behavior. For years, Ms. Fishel said, a destructive stereotype has persisted that says people who are gender-nonconforming are the way they are because they were sexually abused.