TORONTO — The Yankees have their fingers firmly crossed that Masahiro Tanaka can pull out of a slide in time to help them in October as he did two years ago.

Tanaka is scheduled to start against the Blue Jays on Saturday at Rogers Centre, and in his 23rd start of the season, will attempt to get himself out of a dreadful stretch of outings with just seven weeks to go before the postseason.

In his last seven starts, the 30-year-old right-hander went 2-1 and the Yankees won six of the seven games, but that was more a product of the team’s potent bats, which delivered 56 runs in the six wins. The lone loss was a 19-3 shelling the Red Sox dealt to Tanaka on July 25 at Fenway Park.

From June 29-Aug. 5, Tanaka gave up 48 hits (nine of them homers) and 13 walks in 31 ²/₃ innings. His ERA was a bloated 10.23 in those games and hitters batted .340 against him.

“It’s no secret that it is a pretty rough stretch now,’’ said Tanaka, who is 7-6 with a 4.93 ERA this season. “At the same time, I need to be resilient and just really get after it so I can go out there and perform the way I want to.’’

Has this been the toughest stretch of Tanaka’s six seasons with the Yankees?

“It’s pretty similar to what I went through in 2017,’’ said Tanaka, who went 2-2 with a 6.08 ERA in a four-game stretch from Sept. 8-29 that year, in which he gave up 25 hits (six homers) in 23 ²/₃ innings.

What happened that October is something the Yankees will need again in the second season. In three 2017 postseason starts against the Indians in the ALDS and the Astros in the ALCS, Tanaka went 2-1 with a 0.90 ERA and twice didn’t allow a run in seven frames. He held the Astros scoreless in seven during Game 5 of the ALCS that sent the Yankees to Houston leading the best-of-seven affair, 3-2.

Since the day Tanaka arrived in The Bronx from Japan, he has been accountable and honest about his performances. It was that outlook that lifted him out of that late-season funk two years ago.

“What it comes down to is facing the reality and not run away from it,’’ Tanaka said. “You need to focus every day and not run away from it.’’

An improved splitter might help, too.

Tanaka’s calling card throughout his career has been the splitter. However, this year the splitter has misbehaved more often that not. When big-league hitters are able to eliminate one weapon, it makes it difficult for pitchers to work through lineups.

Though Tanaka said the numbers may not suggest progress, he has seen improvement the past two games after he changed the grip on his splitter.

“The results might not show, but I think the pitch itself is getting better,’’ said Tanaka, who is 0-0 with a 6.75 ERA in those two starts, in which the Yankees went 2-0. “I feel I am heading in the right direction with that.’’

So, too, does catcher Austin Romine.

“It is dropping more,’’ Romine said of the splitter. “Sometimes when you feel confident about a pitch it helps you get it back.’’

With a double-digit game lead over the Rays in the AL East entering Thursday night’s action, the Yankees are inching toward their first division title in seven years. In order for them to play deep into October, however, Tanaka needs to flip the same switch he did in 2017.