Standing under the sweltering sun near the Long Island Ducks dugout one afternoon last week, T.J. Rivera refused to call his time in the lowly independent Atlantic League a pit stop.

“Because I don’t feel like anything is guaranteed,” the former Mets infielder told The Post. “I don’t think there’s this easy route out.”

Many have stood in this spot before: 30-something, one-time major league ballplayers clinging to one last bit of hope they can get back to the top of the mountain.

Few do. Most fizzle out here.

The 30-year-old Rivera is keeping his dream alive after being released by the Mets in March after missing all of 2018 recovering from Tommy John surgery. He never got to play in front of the new front office during this year’s spring training because of continued discomfort in his elbow.

“I was very surprised,” he said of losing his job. “But I kind of felt something coming when I had a setback [in his elbow].”

What surprised him more was that no other major league teams came calling after his release.

Rivera has played only 106 games in the big leagues, but in that time proved he can hit and play multiple positions. Undrafted, he climbed through the minors for five-plus seasons before injuries to the Mets lineup led to him being called up in August 2016. He hit .333/.345/.476 in 33 games as the starting second baseman to help get the Amazin’s to the NL wild-card game, and was hitting .290 the following season before undergoing what seems to be a baseball rite of passage: Tommy John surgery.

“I know his agent was trying to get him some tryouts with some other people,” said Ducks manager and 1986 Mets World Series champion Wally Backman. “When it didn’t happen, I called TJ and said I have to make adjustments here because we lost like 15 players [to other leagues] and I said I really need to know [if he would play for us] because I’ve got to do something. I stayed patient to wait for him because I wanted him.”

Backman managed Rivera in the minor leagues, including the 2016 season when Rivera won the Pacific Coast League batting title at Triple-A Las Vegas over teammate Brandon Nimmo, now with the Mets.

Now Backman and Rivera are reunited at Bethpage Park in Central Islip, where every inch of the outfield wall is covered with local ads and a bounce house with a duck mounted on top overlooks the 6,000 seats. It is 45 miles from Citi Field, but in reality a galaxy away.

So far, Rivera is having a good year, albeit against inferior talent. On Thursday he hit a no-doubter to left field in a 9-1 win and is hitting .288/.338/.409 with two home runs and 10 RBIs in 17 games. Backman said three teams are watching Rivera closely, including a playoff-bound American League club that would likely make use of him off the bench. MLB’s new, hard trade deadline (Wednesday, 4 p.m.) could make Rivera more attractive down the stretch.

“If you look at the back of TJ’s baseball card, he’s done nothing but hit,” Backman said. “I’ve tried to do everything to get him to the big leagues. He’s played third, he’s played second, he’s played first. He’s healthy. He’s 100 percent.”

But Rivera is stuck here for now, in the Atlantic League where the average salary ranges from $2,000-$3,000 a month for the six-month season.

It’s a long way from the $556,000 major league minimum he once made with the Mets. Rivera has a 19-month-old daughter, who tries her best to follow along with his pregame stretches when she comes to games. Rivera and his wife have another child on the way, due in October.

“The truth is I’ve always thought don’t have a Plan B because it will take away from your Plan A,” Rivera said. “But deep down just being honest with yourself, you have to — now that I have a family — I have to be able to support them.”