A T-shirt could cost this firefighter his job.

A judge has recommended the FDNY sack Brooklyn firefighter Thomas Buttaro for wearing anti-affirmative-action T-shirts to work, creating what she called a hostile work environment.

“The FDNY is a para-military organization and may restrict a uniformed member’s appearance so long as the restrictions are rationally related to the department’s legitimate interests,” Administrative Law Judge Alessandra Zorgniotti decided.

She found Buttaro, a 17-year FDNY veteran who earned $111,209 in 2013, disobeyed orders after May 2012 to wear regulation gear and not T-shirts with provocative slogans.

The judge said Buttaro engaged in a “persistent and long-term pattern of harassment” and was guilty of “repeated acts of insubordination.”

Buttaro, of Ladder Co. 123 in Crown Heights, would wear T-shirts on duty bearing the logo and slogans of Merit Matters, a group opposed to altering the FDNY’s admissions test to accommodate minority recruits.

Speaking through his lawyer, Buttaro said he planned to challenge the judge’s findings, which are not binding on the FDNY.

“We’re going to fight this for as long as it takes to get vindicated,” said lawyer Adam Weiss. “There are only two sides to the story, and it looks like [the judge] took the prosecution’s side of the story and ignored ours.”

The Post first reported in September that Buttaro, who is white, was facing disciplinary charges for wearing a Merit Matters shirt to work.

The shirts became an issue after Buttaro got into a heated exchange on May 6, 2012, with a black colleague over a suit filed by the Vulcan Society, a fraternal organization of black firefighters that has called the FDNY’s hiring practices discriminatory.

Weiss, Buttaro’s lawyer, said he expects Fire Commissioner Daniel Nigro to make a decision on his client’s fate in the next month.

“Obviously, we disagree with the ALJ’s decision,” he said. “It’s a very skewed version of what happened.”