They knew.

Teachers begged city officials to investigate “School of No” Principal Marcella Sills soon after she started in 2005 — citing her constant tardiness, harassment of staff and extravagant spending on parties while the school lacked books, pencils and paper.

“Get rid of her before it’s too late,” a 2007 letter urged District 27 Superintendent Michelle Lloyd-Bey, who oversees Queens principals.

Letters describe Sills as a tyrant and “rude lunatic administrator” who spurred an exodus of excellent teachers and failed to provide basic student supplies and services while handsomely furnishing her own office and squandering funds on catering and decorations.

“You need to examine Ms. Sills’ inability to lead,” says a 2006 letter from a “concerned teacher” to top Department of Education officials, including Carmen Fariña — now the city’s newly installed chancellor — and then-Chancellor Joel Klein. “Teacher morale is at an all-time low.”

A 2006 letter to Special Commissioner of Investigation Richard Condon — with copies to then-Mayor Michael Bloomberg, Klein and other officials — said Sills “comes in late on a daily basis” and does not record her absences, but calls staffers at home if they call in sick.

The Post revealed last week that Sills for years has arrived hours late, and often failed to show, school sources said. Over the previous week, Sills missed all but one day.

The Far Rockaway school had no math or English textbooks for the rigorous new Common Core curriculum, no gym or art classes — kids watched movies instead — and no nurse’s office. Kindergartners sit in trailers that reeked of animal urine.

Fariña sent a deputy to inspect the school last week but has not publicly acknowledged any specific problems, citing only “significant room for organizational improvement.”

Last week, kids suddenly had gym and art. Dozens of boxes of books were delivered, including the grade-by-grade series, aimed at parents, starting with “What your Kindergartner Needs to Know.”

Condon has launched a probe.

Former teachers gave The Post 10 letters sent since 2005 to Condon, Klein, Lloyd-Bey, Fariña and former Queens Superintendent Kathleen Cashin — now a member of the state Board of Regents. Most of the letters are anonymous, because the teachers feared retaliation by Sills. Some kept a “harassment log.”

The teachers also showed more than two dozen letters and e-mails to reps at the United Federation of Teachers, including then-President Randi Weingarten, now a national union president, but said even she could not help.

Among the complaints, a 2006 letter to Condon, copied to Bloomberg and DOE officials, says Sills threw an elaborate buffet lunch for staff as a “thank you” but asked teachers to sign forms stating — falsely — that they attended a “professional development” workshop. A spokesman for Condon said last week he had no findings to report.

The letter also describes a “fifth-grade extravaganza,” including a dance at El Caribe banquet space, a Broadway show and dinner at a trendy Manhattan restaurant — at an estimated cost of $24,000. Parents had to cough up $90 each.

It was also alleged Sills used a grant from the Alvin Ailey Dance Studio to pay herself overtime, even as school aides went without OT because the school budget had run out of money.

A 2006 letter to Klein called Sills “vicious,” saying she “humiliated” children who were emotionally disturbed and punished school aides who complained about “unsafe, deplorable conditions” in the cafeteria.

Sills, 48, was a graduate of the DOE’s “Leadership Academy,” which trains principals, and had little teaching experience. Insiders said she lacked literacy skills, noting her invitation to a Nov. 23, 2005, holiday buffet “in honor of my gradutitude” to employees, including “security personel” and “custodially staff members.”

Sills ruled by threats and intimidation, ex-staffers complained. She “yells at a volume that resounds throughout the building, slams doors and uses foul language,” a 2006 letter to Condon claims.

That letter also accuses Sills of racism: “She has hired only black teachers and has targeted white teachers and a secretary.” Many left or were forced out.

One former teacher charged that Sills fabricated several observations, rated her “unsatisfactory” and then forged her signature on the documents.

Another red flag was raised in 2009, when the family of a girl student filed a $2 million negligence suit charging staff failed to stop beatings and a sex assault and that Sills did not report the incidents. The family’s lawyer, Adam Thompson, told The Post the city has yet to produce a single witness for deposition. The city Law Department declined to comment.

The DOE would not answer questions on PS 106 or Sills.