CC Sabathia #52 of the New York Yankees stands on...

CC Sabathia #52 of the New York Yankees stands on the mound in the first inning against the Boston Red Sox at Yankee Stadium on Thursday, Sept. 29, 2016. Credit: Jim McIsaac

What seemed all but inevitable when Hanley Ramirez took Dellin Betances deep into the Fenway night for a shocking walk-off three-run homer on Sept. 15 became official exactly two weeks later.

Though the Yankees completed a three-game sweep of the Red Sox on Thursday night at the Stadium with a 5-1 victory behind a brilliant outing from CC Sabathia, they were officially eliminated from the playoff race before the end of the game when the Orioles beat the Blue Jays.

“It’s not what we wanted,’’ Joe Girardi said. “It’s pretty quiet in there, probably the quietest I’ve ever seen it after a win.”

This will be the third time in four years that the Yankees (83-76) will miss the postseason. They lost to the Astros in the American League wild-card game last season and have not played in a Division Series since 2012.

“Obviously, our goal every year is to come in and win the division and win the World Series,” said Sabathia, who allowed one run and four hits in 7 1⁄3 innings Thursday night and wound up with a 2.37 ERA in his final eight starts. “That’s the reason you play with the Yankees.”

Although the Yankees have been eliminated, their final three games will be important: They will host the Orioles while the Red Sox host the Blue Jays, who are tied with Baltimore atop the wild-card standings.

“I will play to win,” said Girardi, though he hedged on whether the Yankees will pitch Masahiro Tanaka — who missed last Monday’s start with a forearm strain — tomorrow against the Orioles. “That’s the right thing to do for this organization, for our fans, but more important, for the game of baseball, because these games mean things to other teams.”

All things being equal, this was not necessarily expected to be the year the Yankees advanced to the ALDS, or even into the wild-card game. And that especially became the case Aug. 1, when general manager Brian Cashman completed a sell-off of some of his club’s top assets.

But the Yankees, spurred in large part by rookie catcher Gary Sanchez, went 17-11 in August and entered September not only in the thick of the wild-card race but also the battle for first place in the AL East.

On Sept. 10, they were 76-65 — one game out of the second wild-card spot, two games out of the first wild-card spot and three games out of first place.

Much of that, however, came unraveled Sept. 15 in Boston when the Red Sox — who clinched the division title Wednesday night despite losing to the Yankees — rallied for five runs in the ninth for a 7-5 victory. That helped spiral the Yankees to a 3-8 road trip that all but ended any hopes of a postseason bid. The Yankees earned their fourth straight victory Thursday night, but it was too late. A 3-11 stretch that had dropped them to 79-76 took care of that.

For Brian McCann, who lost his starting catcher’s job to Sanchez and served mostly as a DH (he has caught Sabathia in the lefty’s recent hot stretch), the costliest slump came early as the Yankees started 9-17.

“Our April was tough,” McCann said, “and we were climbing uphill the rest of the way.”

The 36-year-old Sabathia, whose Yankees future was very much in doubt at the end of spring training when he barely held off Ivan Nova for the fifth starter job, finished 9-12 but with a 3.91 ERA. He is all but assured of returning, as his contract vests at $25 million for 2017 if he does not end this season on the disabled list with a shoulder injury.

Sabathia is looking forward to what is next. “The future is bright,” he said. “We have a lot of good young players in here and a mix of veterans.”

Sabathia said the emergence of some young talent made it a “good” season, but Girardi wasn’t quite ready for a positive spin on 2016.

“I only think about one thing: winning World Series,” he said. “That’s all I think about, and when you don’t make the playoffs and you don’t even get a chance, it’s hard. I hear people talk about some things [successes this season] and I’m like, ‘No, we didn’t do what we were supposed to do.’ ”

The Yankees scored their first four runs with two outs. Starlin Castro had an RBI double in the first inning and Jacoby Ellsbury’s RBI double in the fifth snapped a 1-1 tie. They scored two more in the sixth and another in the eighth on Aaron Hicks’ RBI double — with McCann chugging all the way from first to home — to make it 5-1.

Ellsbury walked with one out in the first and stole second as Sanchez struck out (he fanned four times in five at-bats). It was Ellsbury’s team-best 19th stolen base of the season but his first since Aug. 21 and his second since July 19. Castro then lined an RBI double to left-center.

Sabathia, who struck out the first four batters he faced, held that lead until the fourth, when Xander Bogaerts hit his 21st home run.

More Yankees headlines


Unlimited Digital AccessOnly 25¢for 5 months