A once-respected Brooklyn principal has lost a bid to keep her job after admitting she tried to smuggle heroin and other drugs into an upstate prison, The Post has learned.

Sadie Silver, a rising star at PS 28 in Bedford-Stuyvesant, was busted in July 2014 — but continued to collect her city salary, which was $138,000 last year, until March this year.

Silver and a boyfriend were arrested on charges of drug possession, bringing contraband into a prison, and endangering the welfare of a child. Silver brought her daughter to Coxsackie Correctional Facility.

She and her boyfriend were caught with bags of heroin and suboxone, authorities said. They allegedly tried to sneak the drugs to Silver’s son, who was doing time on weapons charges.

Two years later, in July 2016, she pleaded guilty to introducing contraband into a prison, a misdemeanor, and was sentenced to three years’ probation.

Defended in a three-day hearing as a “brilliant educator” by the city principals’ union, Silver said she acted because her incarcerated son needed money to pay off a debt.

Silver begged for “a second chance,” but hearing officer Joel Douglas terminated her on Feb. 28.