A high-earning state court official was fired Thursday morning — just hours after The Post revealed how he butt-dialed a reporter and inadvertently revealed that “I barely show up to work.”

David Bookstaver, 58, was canned from his $166,000-plus-a-year job as communications director for the Office of Court Administration less than seven weeks before his planned Oct. 1 retirement — and before a Sept. 27 birthday that would have boosted his taxpayer-funded pension.

“New Yorkers look to their Court System for excellence and accountability, and we will always act to apply those standards to all of our employees all across New York State,” OCA spokesman Lucian Chalfen said in a prepared statement.

“While there are occasional abuses of office, we take those abuses extremely seriously and whenever we learn about them we will always act to hold the offenders accountable.”

“We in the New York State Unified Court System cherish and appreciate the integrity of the many dedicated and hardworking judges and non-judicial personnel who serve New Yorkers every day,” Chalfen added.

The Post was preparing an exposé of Bookstaver’s cushy work schedule when it contacted him for comment. The following day, he accidentally called back and left a four-minute voicemail message while discussing the matter with at least two pals.

“I spoke to [the reporter] on the record for awhile. I said, ‘I’m in a much less visible position; that doesn’t mean I’m not doing anything,’” Bookstaver said.

“But, frankly, look, the bottom line: The story’s true. I’m not doing anything. I barely show up to work and I’ve been caught.”

Warning: Graphic language