In many ways it seemed inevitable how Wednesday night’s Subway Series game was going to turn out. In the Yankees’ dugout was a focused team with a mission to reach the postseason. In the Mets’ was a club desperately trying to just field a team while surrounded with palace intrigue.

The Mets had to scratch starters Jose Reyes and Wilmer Flores when both reported rib-cage soreness at batting practice. And Robert Gsellman took the mound just a couple hours after Sandy Alderson admonished him in a news conference for responding to the GM’s critique Tuesday with “I don’t care.”

So the stage was set for the Yankees’ 5-3 victory before a sellout crowd of 42,260 at Citi Field. They have beaten the Mets three straight and Thursday night can pull off just the third sweep in the 21-season history of the Subway Series.

In the seventh, Didi Gregorius lined a two-out, bases-loaded double just inside the rightfield line off Paul Sewald (0-5) to score two for the 5-3 lead. He said he’d been fed a steady diet of changeups and expected fastballs this time, so “I was kind of prepared for it.”

The Yankees went to their endgame, a deep and impressive bullpen, to close it out. Unavailable were closer Aroldis Chapman after he tweaked a hamstring Tuesday and Dellin Betances because he’d pitched three straight days. Adam Warren blanked the Mets in the seventh and eighth, and David Robertson pitched a scoreless ninth for his 14th save and first since returning to the Yankees in a July trade with the White Sox.

“I’ve used Robbie anywhere from the sixth to the ninth, and that’s because he bought in,” Joe Girardi said. He said, ‘I’ll do whatever you want.’ ”

advertisement | advertise on newsday

Said Aaron Judge: “We have probably, if not the best, one of the best bullpens in the game right now. We have our starter go a strong five, a strong six, and just hand it over to them.”

Judge hit a mammoth 457-foot home run in the fourth inning. But he also whiffed in the ninth, giving him a record for position players with 33 straight games with at least one strikeout.

The Mets had to get creative just to compete without Reyes and Flores. When the Yankees finished batting practice, Travis d’Arnaud took ground balls at third to prepare for his first start at a position other than catcher.

Terry Collins employed a strategy he said he once used at Triple-A Salt Lake City in 1976 in a similar situation. He hid d’Arnaud from the ball by playing him at third against lefthanded hitters and switching him with second baseman Asdrubal Cabrera against righties, except in some double play situations.

It worked. They switched 22 times and d’Arnaud got only one ball hit to him, a ninth-inning pop-up.

Mets videos

“I thought it was really smart on Terry’s part — d’Arnaud has never played the infield,” Girardi said. “They were trying to give him the least amount of chances as possible. I thought it was pretty brilliant.”

Jaime Garcia faced the pressure of seeking his first win in three starts since his deadline acquisition from the Twins. Gsellman faced something quite different.

He did not pitch well during three months in the rotation before a hamstring injury. Healthy again, the Mets left him in the minors because Alderson said he needed to “pitch better” to return to the Mets. He got this chance only because of Seth Lugo’s injury, and when asked about Alderson’s critique Tuesday he gave his “don’t care” response.

Alderson was clearly angered. At a pregame news conference, he said: “I hope he reflects on the implications of that statement and the potential consequences of that statement and has a better response the next time out.”

The Yanks led 2-1 when Judge planted his 37th home run in the third deck in left. But they gave up that lead on Rene Rivera’s solo homer and yielded a 3-2 edge on a d’Arnaud sacrifice fly.

advertisement | advertise on newsday

Girardi said the results are the thing. “We talked about it: Just win games.”