A Brooklyn lawmaker is accusing Major League Baseball of disrespecting 9/11 first responders by refusing to allow the Mets to wear caps honoring the heroes on the anniversary of the terrorist attacks.

City Councilman Justin Brannan fired off a scathing letter to MLB Commissioner Rob Manfred last week demanding the league let the Mets wear caps emblazoned with “NYPD,” “FDNY” and other first-responder agencies for the anniversary of the Sept. 11, 2001, attacks. Any other teams wishing to do so should be allowed also, Brannan wrote.

The Bay Ridge-based Democrat made the plea after MLB rejected the team’s latest request – made through star rookie slugger Pete Alonso — to wear the special caps during a home game last Wednesday on the 18th anniversary of 9/11.

“This [MLB] decision was a real slap in the face to all the first responders who stepped up during the worst terrorist attack in the history of our nation, with many making the ultimate sacrifice, right here in the greatest city in the world where the Mets play,” Brannan wrote Manfred.

“This isn’t just about New York City, it’s about America,” the pol seethed.

“Baseball may be our national pastime and as American as apple pie, but this decision was anything but. Fans are angry, players are angry, and the first responders and their families feel disrespected.”

Brannan, who regularly describes himself as a “long-suffering Mets fan,” asked why the league would allow the Houston Astros to wear Apollo 11 caps in July to commemorate the first moon landing 50 years ago, yet won’t allow the Sept. 11 tribute.

Following the 9/11 attacks that left 2,753 dead at the World Trade Center, the Mets famously began wearing caps honoring cops, firefighters and other first responders — despite initial objections from the league — for the remainder of the 2001 season.

The Mets have regularly asked MLB for permission to repeat the tribute but have been denied each time since.

The latest failed bid was made directly by Alonso, who ultimately did an end-run around MLB by ordering customized 9/11-inspired cleats for his teammates.

The club wore the special red, white and blue cleats — which included a silhouette of the Twin Towers and the inscription “We will never forget” – while collecting nine runs on 11 hits during a 9-0 blowout win over the Arizona Diamondbacks.

MLB opted not to penalize the Mets or Alonso for breaking league dress code rules, but Brannan believes it’s ridiculous that the team even has to ask for permission to pay tribute to 9/11 heroes.

When asked about Brannan’s complaint, an MLB source said the league directs teams to “honor tragedies however they want on the field” – but only during warmups and other pregame activities.

“The league handles it this way so that [it isn’t] in the position of judging which tragedies should and shouldn’t be recognized during a game after a series of club requests were made,” the source said.

Despite rejecting the Mets’ request, the league did observe 9/11 last Wednesday with ballparks holding a moment of silence and pregame ceremonies. Players and coaches wore team caps – but they included a special side patch featuring a red, white, and blue ribbon, a modified version of the MLB logo with a US flag, and a caption reading “September 11, 2001 WE SHALL NEVER FORGET.”

This is not the first time Brannan has taken on MLB and Manfred.

Incensed over MLB’s rain delay rules soaking fans’ wallets, Brannan in May wrote the commissioner urging him to implement a new policy requiring umpires to call games once delays stretch more than an hour so fans are not “lingering endlessly.”

Manfred brushed back the pol’s pitch by telling him the proposal is “impractical.”