The beloved longtime handyman for Stuyvesant HS is being fired after 23 years on the job because he never passed a civil-service exam, The Post has learned.

Kern Levigion, 54, who has been praised for everything from providing theater lighting to configuring security and climate systems, fixing phone lines and repairing furniture, is now considered unqualified to keep the job he’s performed for three decades because of a bureaucratic rule change.

Levigion, who helped Stuyvesant respond to and recover from the 9/11 terror attacks, is considered a “provisional” or temporary worker because of the issue over the civil-service exam.

“He does everything. He’s Mr. Fix It,” a Stuyvesant staffer said of Levigion. “We don’t know what we would do without him.”

Yet the city is under court order to get rid of thousands of its provisional workers — even those like Levigion, who received a certificate in 2012 for “20 years of dedicated service” to the school.

“Due to your provisional status with the New York City Department of Education and Civil Service rules, I regret to inform you that your service as a provisional machinist helper cannot be maintained,” DOE human-resources director Angela Hayes-Spencer wrote in an April 22 letter to Levigion. “Therefore, your service as a provisional machinist helper will be terminated effective close of business May 6, 2015.”

Under state law, Levigion was required to take and pass a civil-service exam to become a “permanent” employee.

Levigion could have taken the machinist helper civil-service exam in May 2014. When he didn’t take it, his name did not appear on a hiring list.

But Levigion says he didn’t even know the test was being offered.

“Nobody notified me,” he said, noting no one ever told him he was required to pass an exam to preserve his job of 20-plus years.

City officials said all provisional employees must be “removed” within four months after the list is established, under the law.

Levigion is not alone. The de Blasio administration has reduced the list of provisional workers from 22,954 last fall to 21,536 by Feb. 28 of this year, according to the Department of Citywide Administrative Services.

A Post analysis of the reductions in provisional jobs indicates that more than 500 lost their jobs. Hundreds of others retired while some passed the civil-service test.