The Yankees’ season ended with a thud Tuesday, and their offseason isn’t starting any better. Shortstop Didi Gregorius needs Tommy John surgery on his throwing elbow, the team announced Friday, and will be out for at least a significant portion of 2019.

The shortstop underwent an MRI exam Thursday that revealed a torn ulnar collateral ligament after Gregorius complained of discomfort in the area during the ALDS against the Red Sox.

“It’s tough news,’’ general manager Brian Cashman said at the Yankees’ season-ending press conference Friday at The Stadium. “He’s a great player. He’s an important player for us. We’re going to be without his abilities for a period of time, [until] sometime next summer.”

Cashman admitted he doesn’t have a lot of experience with position players undergoing the procedure on their throwing elbows, so there is added uncertainty. Gleyber Torres hurt his non-throwing elbow in the middle of 2017 and missed the rest of that season, but this is more complicated.

In speaking to multiple doctors, the estimated timetable for return ranges from 8-10 months. Because Gregorius is looking to have the surgery soon, that means he would be back in June at the earliest.

“He’ll do everything to get back on track, and it’s our job to hold the fort until he does,’’ Cashman said.

That means finding a replacement — whether on a temporary or full-time basis.

Torres came up through the minors as a shortstop before moving to second base full-time last season, but he is better suited for his current position.

The Yankees could re-sign free agent Adeiny Hechavarria, who was acquired from Pittsburgh late in the year and filled in for Gregorius when he missed time with a bruised left heel.

A much more compelling option is Manny Machado, set to hit the open market after the Dodgers’ season is over. There has been no shortage of speculation about whether Machado would be a fit in The Bronx and Gregorius’ injury will only add fuel to that fire.

“I feel for Didi, I am not talking about that and I’m not worrying about any of that stuff in the future,’’ Machado said at his locker after hitting a homer and driving in three runs in the Dodgers’ 6-5 Game 1 loss to the Brewers. “I’m in the postseason now and that’s where my focus is totally.’’

Cashman said Torres is “clearly the best player for consideration that we have.”

The Yankees are set to have their organizational meetings later this month, when Cashman will talk to his scouting and analytical departments about any potential roster moves — shortstop and otherwise — and then bring recommendations to managing general partner Hal Steinbrenner.

Whether they decide to try to stay under the luxury-tax threshold in 2019 — set for $206 million — as they did this season remains to be seen, but that decision would play a role in how they look to fill the position.

Cashman said Friday he was aware of a partial tear in the ligament when he traded for Gregorius from Arizona prior to the 2015 season and that it was “asymptomatic.”

They believe Gregorius suffered the current injury during Game 2 of the ALDS at Fenway Park, when he went out to short left field after Andrew McCutchen misplayed a ball hit off the Green Monster by Ian Kinsler in the seventh inning. Gregorius remained in the game and played the final two of the series, but bounced several throws to first base.

“He said, ‘I’m fine, I’ll be good,’ but I thought about a worst-case scenario when I saw him bounce two balls in the final game here,’’ Cashman said. “They were un-Didi-like. You don’t see that. So right away, in the back of my mind, I thought, ‘Oh boy, I wonder if we have a real problem here.’ Unfortunately, the MRI confirmed that we do.”

Gregorius will be a free agent following next season and is coming off his best year at the plate. His absence, depending on how the Yankees fill it, will leave a significant hole in the lineup and the defense.

“We do expect to get him back and expect him to return to the player we’ve been enjoying for quite some time,’’ Cashman said. “We’ll wait on him, but how we handle the waiting … is yet to be determined.”

— Additional reporting by Greg Joyce and Kevin Kernan