ST. PETERSBURG, Fla. — Throughout a dreadful season for Gary Sanchez that has led to questions about his long-term future with the Yankees, Aaron Boone has drilled home the fact the catcher hasn’t slacked off in his work habits.

As one passed ball followed another and vaulted Sanchez to the top of the major league leaderboard and the batting average continued to dip, Boone never changed his tune.

Marcus Thames, the Yankees’ hitting coach who oversees Sanchez’s batting practice sessions, says hasn’t seen Sanchez shirk the responsibility to get better even while there were games when he looked dreadful at the plate and behind it.

“It’s been a rough ride for him, guys depend on him,’’ Thames said of Sanchez, who hit a three-run homer and a run-scoring single in the Yankees’ 9-2 win over the Rays on Tuesday night in front of 10,953 at Tropicana Field. “It was a big night. We have to make sure we build on it.’’

That remains to be seen, because even after the solid game Sanchez is still hitting .184 and one good game doesn’t guarantee anything more than that.

The hope around the Yankees is that Sanchez can use the final five games to get right, forget about the brutal regular season that included two stretches on the disabled list, help the Yankees get by the A’s in the AL wild-card game and play deep into October.

“You look up at the board and you are hitting .183 or whatever, that’s rough,’’ Thames said. “But I told him, ‘It’s go time, finish strong.’ He has to keep his confidence. He knows he is a good hitter and his teammates believe in him. The batting practice has been good, the cage has been good. I keep preaching about positives because this game will eat you up.’’

The victory and the A’s 10-8, 11-inning loss to the Mariners moved the Yankees’ lead in the chase for the top wild-card spot to 2 ¹/₂ games. It also reduced the Yankees’ magic number over the A’s to two. Any combination of Yankees wins and A’s losses totaling two means next Wednesday’s lose-and-go-home game will be played at Yankee Stadium.

Luis Severino benefited from Sanchez’s big night as well as from home runs by Adeiny Hechavarria and Miguel Andujar. Severino went five-plus innings in which he allowed two runs, four hits and whiffed seven. Even though he is 19-8 with one start remaining, he likely won’t be the starter against the A’s.

As for Sanchez, he didn’t gloat about his evening.

“It always feels good to help your team win, especially when you bring in a couple of runs,’’ said Sanchez who hit a 3-1 pitch from Jalen Beeks over the left-field fence for the final three runs of a seven-run third that matched the most runs scored by the Yankees in an inning this year. “That’s what you want to do.’’

Joe Torre’s advice to players who had long ago been eliminated from having a solid six-month season was to forget it and act like that day was Opening Day because there isn’t an avenue to undo what is done.

Sanchez says he is of that mindset.

“Whatever I have done in this season is in the past,’’ said Sanchez, who leads the majors with 17 passed balls but made two strong defensive plays Tuesday night. “Any game I have a chance to contribute that’s what I want to do.’’

Thames is right about it being “go time’’ for Sanchez, because he was expected not only to hit in the middle of the lineup but shoulder a big bulk of the load for the Yankees despite the pairing of Giancarlo Stanton with Aaron Judge.

Now Sanchez has five games to get right and turn a miserable regular season into dust by helping the Yankees play deep into October.