His first thought was to get custom baseball caps with a 9/11 theme, but Major League Baseball blocked the idea with a mile of red tape, so Pete Alonso came up with another plan.

The Mets first baseman would buy each of his teammates custom-made cleats with different designs honoring the 9/11 first responders, and to heck with approval from MLB.

So the Mets took the field Wednesday night at Citi Field wearing their 9/11 shoes to honor the victims, families and first responders. The result was a 9-0 Mets win over the Diamondbacks on 11 hits. And if you think the baseball gods weren’t applauding Alonso for his efforts, then maybe you should look again at the final boxscore.

“For me, it came from a place where I wanted to show support,” Alonso said, “not to just the victims but the families as well, because no one knows how deep those emotional scars can be.

“I just wanted to show recognition to all the ordinary people who felt a sense of urgency and an admirable call of duty. It’s for all the people that lost their lives and all the people that did so much to help.”

Since 2017 — the year after their most recent postseason appearance — this has been the most meaningful game the Mets have played in September: the game on 9/11 to honor the first responders and the lives lost as a result of the horrendous events 18 years ago.

Wednesday’s anniversary at Citi Field carried added significance, with the Mets needing to win as many games as possible to stay in contention. These are the kind of meaningful games the Mets had hoped to play in September.

“This is what you come to the field every day for — to do something special,” manager Mickey Callaway said before the game.

Turns out Alonso did something special by going to great lengths to provide the unique shoes.

“I wanted to recognize what this day is really about,” he said. “I don’t want it to be like a holiday. I want it to be a day of remembrance about everything that happened.”

It’s gotta be the shoes. After pregame ceremonies during which the Mets mingled on the field with children and grandchildren of 9/11 victims, the home team erupted for five first-inning runs, including back-to-back home runs by Todd Frazier and Brandon Nimmo. Frazier and Jeff McNeil hit a pair of home runs on the night and Steven Matz pitched six shutout innings as the Mets cruised to their third straight win, and they will look to sweep the Diamondbacks on Thursday afternoon.

“I’m happy everyone wore the shoes,” Alonso said. “We could have gotten fined for it, but everyone was willing to back up the cause. I’m glad everyone was behind me and stuck with this. I hope the general population appreciates this.”

Alonso is just a rookie, but the Home Run Derby king isn’t afraid of incurring MLB’s wrath for breaking a uniform code. Some things are more important.

“I felt if MLB got their hands on it, it may not have been approved,” Alonso said. “But I’m happy we banded together in the clubhouse and made something cool happen.”

Alonso said he was a first-grader in Tampa when the 9/11 attacks shocked the country in 2001. He remembers his easygoing parents being distraught. Living in New York has given it a whole new meaning. He will never forget.

“I want to bring awareness to people on the outside looking in that this is a really big deal,” he said.

Alonso walked around the clubhouse in recent days collecting shoe sizes and what brand each player wore. He compiled notes and worked with his agent to get the shoes painted.

“They’re really cool shoes,” he said. “If we keep winning games by a lot, I think we’re going to have to keep wearing the shoes.”

Purchase event tickets to “The Amazin’ 1969 New York Mets: A World Championship for the Ages” presented by The Paley Center for Media and the New York Post. Enter promo code: NYPOST to unlock tickets only available for Post readers.