Taxpayers just received a holiday gift from a federal judge, while an embattled city politician was left with a lump of coal.

Assemblyman William Boyland Jr. (D-Brooklyn) had been asking for taxpayers to pick up the tab for his legal defense at his upcoming corruption trial.

It was a pitch the legislator had made successfully to a Manhattan federal judge last year, when tax dollars were used to pay legal fees for his previous, unrelated corruption trial, which ended with his acquittal.

With the approach next year of his second trial in as many years on charges of corruption, Boyland once again claimed he couldn’t afford defense attorneys.

But Brooklyn federal Judge Sandra Townes quickly shot down the indicted Brooklyn Democrat, telling him he has more than enough money to pick up the bill.

The judge told the assemblyman his financial circumstances clearly make him ineligible for subsidized counsel.

“Mr. Boyland simply does not qualify,” Townes said during a recent court hearing.

“Anybody who owns property valued at $460,000 and who is receiving the salary of an assemblyman and who is receiving $960 a month in rental income is capable of financing his defense,” the judge said from the bench.

Boyland’s salary as an assemblyman is $79,500 a year, plus per diem.

“He’s made an application — and I’m denying it,” Townes said.

The judge’s decision is a welcome, if slight, relief for taxpayers. Legal experts put the defense cost for Boyland’s upcoming trial between $75,000 and $200,000.

But now, Boyland will actually owe Uncle Sam.

Townes said he will have to pony up after taxpayer money was erroneously paid to reimburse his current defense team because of an administrative mistake.

“Mr. Boyland will have to repay those funds,” the judge said.

Boyland is awaiting trial in July on charges that he solicited more than $250,000 in bribes and accepted thousands of dollars in illicit payoffs in exchange for his promise to grease the wheels on local development projects.

Earlier this year, The Post reported that Boyland claimed $17,606 in taxpayer-financed per-diem payments — on top of his legislative salary — for attending legislative sessions and for trips outside his district.

His per-diem claims were more than those submitted by 131 of the Assembly’s 150 members, state records show.

The lawmaker also missed 280 legislative votes this year, more than all but four of his Assembly colleagues — three of whom were running for Congress, the New York Public Interest Research Group report found.