Marcus Stroman of the Yankees pitches during the first inning...

Marcus Stroman of the Yankees pitches during the first inning against the St. Louis Cardinals at Yankee Stadium on Friday. Credit: Jim McIsaac

TThe Yankees returned to the Bronx on Friday night with 78 wins, the most in the American League, and yet were fresh off a head-scratching, mind-numbing, difficult-to-explain series loss to the full-rebuild Nationals.

Sometimes that kind of thing is hard to understand. How can a team with a $313 million payroll, third-highest in the sport, stumble around the banks of the Potomac River for three days like tourists suffering from heat stroke?

“It happens,” Juan Soto said.

But with September around the corner and a division title to win, the Yankees’ mission for this final month of the regular season is to prevent any more of those lapses. In that sense, Friday’s 6-3 victory over the lowly Cardinals served as a preview of what they should be gearing up to be come October.

Figure Austin Wells to play a big role in that. And speaking of warm-up acts, the team screened an old TikTok video of a Wells college-era dance routine — complete with shaggy hair and beard — during the pregame hitters meeting for laughs. What the Yankees ultimately got from Wells was much bigger than a few giggles as he swatted a pair of two-out, two-run homers, the second coming with a bat flip in the eighth inning.

“It was funny,” Soto said of the Wells TikTok. “He gets everybody going. He gets the vibes. I mean, what else can we ask for?”

True. Wells already is doing it all, both behind the plate and standing beside it. He has 12 homers, the second most by a Yankees rookie catcher during a single season, trailing Gary Sanchez’s 20 in 2016. He’s also hitting .346 (28-for-81) with three doubles, a triple, five home runs and 21 RBIs in 20 starts in the cleanup spot (i.e., serving as Aaron Judge’s primary protector in the lineup).

“I’m having a lot of fun with it,” Wells said. “I’m accepting it and embracing the challenge. It’s baseball — you’re going to fail a lot. So every win is a lot bigger for me. I try to keep the highs high and the lows not too low.”

The Yankees had plenty of highs Friday night, from Marcus Stroman pitching seven innings for the first time since May 31 — he’s 3-0 with a 2.35 ERA in his last four starts — to Soto’s contributions with both his bat and glove.

Soto’s RBI double (his 96th RBI) tied the score at 2 in the third inning before Wells’ first blast, and the rightfielder cut down Alec Burleson trying to stretch a single in the fifth. After the depths of D.C., the Yankees bounced back with a solid team-wide effort against a club they should beat in the going-nowhere Cardinals.

“This is the time to get hot,” Wells said. “Through the rest of the season and into the playoffs.”

That roll needs to gain momentum during the Cardinals’ holiday weekend trip to the Bronx. Funny thing about that mediocrity, though. It’s the .500 (or below) teams that tend to give the Yankees fits.

Earlier this month, the Tigers took two of three from Aaron Boone & Co., including that two-blown-save finale in front of the Little League World Series attendees in Williamsport.

Tack on the humbling Nationals series and the Yankees’ record against .500 teams or worse was a pedestrian 34-26 before Friday. Not exactly the sort of bully behavior you’d expect from a real World Series contender, but we’d argue that that’s the whole MLB experience right now, and so would Boone, who sounded a tad annoyed when the subject was brought up Friday afternoon.

To put the conversation in context, it was mentioned that the Yankees also have risen to their level, going 44-30 against clubs above .500, tied with the Brewers for the second-highest win total (Atlanta was tops with 45). But Boone bristled at the suggestion that something is lacking in the Yankees’ competitive DNA when it comes to beating up on the non-contenders.

“Bottom line is, we’re a pretty good team,” Boone said. “We’re not perfect. We’ve got a great opportunity with a month or so to play to give ourselves a chance to play in October, and that’s what we’re working towards.”

It’s difficult to know exactly where the Yankees were on that spectrum at the moment. After a 10-23 stretch, they are 19-11 since July 27 and have won seven of their last 10 series, but those three series losses were against the Angels (55-80), Tigers (68-68) and Nationals (61-74).

Working in the Yankees’ favor? There are no juggernauts looming this October. With parity throughout the sport and no teams currently on pace for 100 wins, “pretty good” should be effective this postseason. But the Yankees taking care of business against the mediocre foes — the Cardinals are the first of six middling-to-bad opponents in their final 27 games — will be key in nailing down that all-important AL East crown.

“If we don’t play well, we can get beat,” Boone said. “But we also know that when we play well, we can beat anyone in the league.”

With September arriving Sunday, it’s time to start showing more of the latter.

SUBSCRIBE

Unlimited Digital AccessOnly 25¢for 5 months

ACT NOWSALE ENDS SOON | CANCEL ANYTIME