BOSTON — Thursday night’s loss, which ended on Hanley Ramirez’s three-run homer off Dellin Betances with two outs in the ninth inning, retired the trophy for worst Yankees defeat of the season.

The No. 2 slot on that list is very much up for grabs, and Saturday afternoon’s 6-5 loss to the Red Sox at Fenway Park put itself firmly in contention as the Yankees’ already waning playoff hopes took another significant hit.

“A lot’s changed in the last 48 hours, really,” Brett Gardner said in a quiet clubhouse. “Thursday, we’re an out away from being [two] games out in the wild card, three games back in the division, and here we are seven games back in the division and I don’t even know where the wild card stands at this point. But we have to win. We obviously put ourselves in bad position the last couple days.”

After blowing a 5-1 lead on Thursday night — and a 5-2 lead with two outs in the ninth inning — the Yankees brought a 5-2 lead into the bottom of the fifth Saturday, thanks to Gardner’s RBI triple, Gary Sanchez’s two-run homer and Austin Romine’s two-run double off an ineffective David Price.

But the Yankees again could not hold off Boston’s potent lineup, and what proved to be the winning run scored in the seventh on a two-out wild pitch by Adam Warren. “I didn’t do my job,’’ said Romine, who repeatedly blamed himself for not stopping it.

The Yankees (77-71), who had climbed within one game of the second American League wild card after their seventh straight victory last Saturday, lost their fourth straight game and sixth in the last seven. They remained four games behind the Orioles and Blue Jays, who are tied atop the wild-card standings, and are a game behind the Tigers, Astros and Mariners.

advertisement | advertise on newsday

“I don’t lose faith. That’s not who I am,” Joe Girardi said. “I know some people do, but I don’t. Do you see them fighting? They [his players] ain’t giving up.”

Making the loss even more damaging, Starlin Castro, the club leader in homers with 21, left in the fifth inning with a strained right hamstring and Jacoby Ellsbury left in the eighth with a right knee injury, suffered an inning earlier while he attempted to make a sliding catch and hit the wall.

Girardi said both players are scheduled to undergo MRIs on Sunday in New York. “Hopefully, they’re not too severe,” he said. “I’m pretty worried about Castro and that hamstring, the way he pulled up [between first and second while running out a double].”

Price came in 16-8 with a 3.81 ERA, including 7-0 with a 2.16 ERA in his previous seven starts. But for all of his career success, he’s been spotty against the Yankees. The lefthander entered the game 14-9 against them but had a 4.35 ERA. In three starts this season, it was 1-2 with a 7.79 ERA, and he more resembled those numbers while allowing nine hits and five runs in six innings. Two came on a mammoth homer by Sanchez onto Lansdowne Street in a three-run third inning that made it 3-0. It was Sanchez’s 15th homer in 40 games and came in his 152nd at-bat.

Bryan Mitchell took the mound in the fifth with a 5-2 lead but walked leadoff man Jackie Bradley Jr. and allowed a two-out, two-run homer by Xander Bogaerts on a pitch that nearly hit him. “The leadoff walk in the fifth is what ultimately cost me,” Mitchell said. “Bogaerts put a pretty unbelievable swing on a ball in off the plate.”

Yankees videos

Luis Severino, who had allowed zero earned runs and five hits in 18 2⁄3 innings in eight previous relief appearances, replaced Mitchell at that point. He escaped a bases-loaded jam in the sixth by striking out Dustin Pedroia looking, but Bogaerts led off the seventh with a double on the ball to center that Ellsbury couldn’t quite get to in the triangle. Tommy Layne got David Ortiz to fly to center, moving Bogaerts to third, and Warren allowed an RBI single by Mookie Betts that tied it at 5.

Ramirez singled for his third hit of the day and both runners moved up on Travis Shaw’s groundout. With Sandy Leon at the plate, Warren’s 1-and-1 pitch was inside and in the dirt, and when the ball kicked off Romine up the first-base line, Betts scored the go-ahead run. After Romine retrieved the ball, turned his back to the plate and then looked down, Ramirez also tried to score and was tagged out by Romine.

Craig Kimbrel came in with two outs and a runner on first in the eighth and struck out all four batters he faced for his 27th save.

“Don’t expect this group to give up until we’re eliminated,” Warren said. “I don’t think anyone in here thinks we’re completely out of it, but we know it’s going to be tough.”

advertisement | advertise on newsday