It seemed almost a foregone conclusion, as recently as a week ago, that Zack Wheeler would be pitching for a playoff contender.

Now, perhaps he is — in Queens.

The right-hander was excellent Tuesday night for a second straight start as the red-hot Mets continued rolling with a 5-0 win over the Marlins at Citi Field.

Wheeler threw eight shutout innings, raising his total to 15 straight scoreless innings since last Wednesday’s trade deadline came and went — and he stayed with the Mets.

His performance led the Mets to their 12th win in 13 games, as they look to make an improbable run to the playoffs over the final eight weeks of the regular season. It’s their best stretch in four years.

“We know how good we can be and how good we are,’’ Wheeler said. “We’re shooting for it.”

The Mets’ decision not to dump their veteran players, including Wheeler, at the trade deadline proved to be a spark.

“It was a huge jolt,’’ Mickey Callaway said of the Mets keeping their team — especially their rotation — intact. “I think when 4:01 [p.m.] hit that day, you saw a lot of excitement in the clubhouse. Guys have gone out and backed up the moves we did make and didn’t make.”

Since bottoming out at 11 games under .500 on July 12, the Mets have gotten back in the playoff hunt. A day after they got over .500 for the first time since May 16, they made it to two games over for the first time since April 24. The Mets are now 1¹/₂ games behind the Phillies — who lost to the Diamondbacks — for the final wild-card spot. But they still trail the Cardinals and the Brewers in the playoff standings.

And if Wheeler keeps up what he has shown in his past two starts, they will have an even better chance to make sure this turnaround isn’t a fluke.

“The fact he wasn’t traded is big because he made his debut here and been part of the starting rotation for a really long time,’’ Pete Alonso said. “I feel like if he was gone, there would be a missing piece. He’s been electric.”

After Wheeler kept the White Sox scoreless in Chicago last week, he was dominant again with another gem against a Marlins team that has dropped five straight.

Wheeler, in his third start since returning from an injured list stint due to shoulder fatigue, pitched around a one-out double by Jon Berti in the first and a leadoff double by Berti in the fourth.

He responded with a pair of strikeouts to end the top of the sixth after Luis Guillorme, Tuesday’s second baseman, missed second base on what should have been an easy forceout.

Overall, Wheeler was at his best when it mattered most, holding Miami hitless in a dozen at-bats with runners in scoring position, as he tossed a season-high eight innings.

The offense, which was without both Michael Conforto and Amed Rosario — who were both given the night off — provided plenty of support against former Yankee Hector Noesi, who was making his first appearance in the majors since 2015.

A Todd Frazier fly ball to left was generously ruled an RBI double in the first inning although Berti flubbed it. It marked the sixth consecutive game in which the Mets scored in the first.

The big blow came in the third, when Wilson Ramos blasted a three-run homer to center, scoring Jeff McNeil and J.D. Davis to make it 4-0.

Alonso’s 36th homer of the season came with two outs in the fifth. It was Alonso’s second home run in as many games after the first baseman snapped a career-long 30-game homerless drought on Monday.

The Mets will look to finish off the sweep Wednesday before a day off and then a visit from the Nationals, as their schedule gets more difficult.

“We understand who we’ve been playing, but that doesn’t matter to us,’’ Callaway said. “We try to win every single game every day and if we take that approach, you really shouldn’t worry about opponent.”