MINNEAPOLIS — It’s as if the entire Yankees offense participated in the Home Run Derby.

Though Aaron Judge’s slump to open the season’s second half has garnered much of the attention, the vast majority of his teammates have swung wood just as dead.

That continued Monday night in a 4-2 loss to the Twins in front of 27,566 at Target Field.

The Yankees (47-44), who have lost 21 of their last 30 games, scored 11 runs in splitting their four-game weekend series against the Red Sox at Fenway Park. That included being shut out for the first time this season Sunday night.

“You wonder if the break, some guys kind of got out of rhythm a little bit,” Joe Girardi said. “And the only way to get back into rhythm is to keep playing. And even though we only scored two runs, I thought we swung the bat a lot better than that tonight.”

They did rally from a 2-0 deficit — Garrett Cooper and Austin Romine had back-to-back two-out doubles in the fifth and Chase Headley and Cooper had back-to-back doubles in the seventh to tie it — but ultimately wasted a solid spot start by Bryan Mitchell and relief outing by lefthander Caleb Smith, who made his major-league debut. The Yankees went 2-for-11 with runners in scoring position and stranded seven.

advertisement | advertise on newsday

Smith, who was tagged with the loss, allowed two runs in the eighth after pitching a perfect sixth and seventh. He struck out five in his three innings.

“It’s not his fault we lost,” Clint Frazier said. “We didn’t score runs when we had the opportunity and they did.”

The loss overshadowed a big night at the plate by a pair of rookies. Cooper went 3-for-4. Frazier, who batted second, had leadoff doubles in the sixth and eighth but was stranded each time.

Joe Mauer began the bottom of the eighth with a single to right as Judge, who went 0-for-3 to fall to 1-for-21 since the All-Star break, just missed making a diving catch. Miguel Sano singled to left, but Smith struck out Max Kep ler after he failed to get a bunt down. Pinch hitter Eduardo Escobar then lined an RBI single to left and Eddie Rosario doubled to make it 4-2.

“I missed on a slider,” Smith said of the pitch to Mauer. “And then a changeup [to Escobar]. I thought it was two pitches I didn’t execute on, and it cost me.”

Yankees videos

Girardi said his bullpen still was short and that he preferred to stay away from Aroldis Chapman, Tyler Clippard, Chad Green and Chasen Shreve. “Didn’t really have a lot of options,” he said.

He had Dellin Betances to close and would have gone to Adam Warren had his club been able to get Frazier home from third in the top of the eighth. But Didi Gregorius, trying to surprise the Twins with a two-out bunt, executed poorly and was thrown out by catcher Jason Castro.

Mitchell allowed two runs (one earned) and six hits in five innings. Twins lefty Adalberto Mejia, who came in 4-4 with a 4.43 ERA but had a good slider working Monday night, allowed one run and five hits in 5 1⁄3 innings.

With the bases loaded and none out in the third, Judge caught Sano’s line drive and threw out Brian Dozier at the plate to nearly get the Yankees out of the inning, but the Twins still scored a run.

When Kepler rolled a grounder wide of first base, Starlin Castro made a perfect throw to Mitchell covering the bag that was in plenty of time, but Mitchell — who actually played an inning at first earlier in the season and dropped a foul pop — had the ball go off his glove, and his error made it 2-0. “I was there, I was on the bag,” he said. “Just a ball I need to catch.”