Rangers defenseman K'Andre Miller, center, celebrates with Alexis Lafreniere after they...

Rangers defenseman K'Andre Miller, center, celebrates with Alexis Lafreniere after they defeated the Dallas Stars in overtime of an NHL game Thursday at Madison Square Garden. Credit: AP/Adam Hunger

GREENBURGH, N.Y. — Patience is a virtue.

So sayeth Gerard Gallant.

The Rangers’ coach preached patience on an almost daily basis during the first 26 games of the season as his team struggled to find its footing.

Seventeen games later, a team touted as a potential Stanley Cup contender appears to be rounding into form.

“I really believe we played pretty good hockey the first part of the season,” Gallant said after practice Saturday at the MSG Training Facility. “We didn’t get the points that we thought we should have. But overall I think we played pretty good, especially in the last month-and-a-half, and we’re starting to find ways to win hockey games we were losing in the first 20 games of the season.”

The Rangers, who will host Montreal in a 5 p.m. start Sunday, began the season by going 11-10-5 in their first 26 games, culminating in a bad loss to Chicago on Dec. 3 in which Jacob Trouba threw his helmet against the boards as he skated off the ice.

But in the last 17 games, the Rangers have ripped off a 13-2-2 run. They have climbed into third place in the Metropolitan Division, two points behind the second-place Devils and four behind Carolina entering Saturday.

“We went through a lot of this last year and having to fight until the last buzzer,” said K’Andre Miller, whose goal with nine-tenths of a second left in regulation against Dallas tied it at 1-1 on Thursday, setting the stage for Adam Fox’s overtime winner.

“We had a lot of comebacks last year and I think that was one of the biggest things: just sticking with it for a full 60 minutes, knowing that even if our chances weren’t going in or you’re hitting posts or whatever the case may be, we’re still getting the chances. We’re still doing the things to put ourselves in the right position to produce or win those games.”

Their collective belief will be tested against the Canadiens, who played the Islanders on Saturday night at UBS Arena, because the Rangers likely will not have two lineup regulars. Before practice, the team said left wing Chris Kreider is doubtful with an upper-body injury. Fourth-line right wing Julien Gauthier will sit out with an upper-body injury. Defenseman Ryan Lindgren, right wing Vitali Kravtsov and left wing Artemi Panarin all missed practice with a stomach bug.

Without Kreider, who missed the game against the Stars, Alexis Lafreniere again will slot in as the left wing on the top line. Jake Leschyshyn, who was claimed off waivers from Vegas on Wednesday, will make his Rangers debut and center the fourth line between Sammy Blais and Jonny Brodzinski.

“Obviously a huge opportunity for myself,” said Leschyshyn, who is the son of former NHL defenseman Curtis Leschyshyn. “I’m trying to bring some energy to this team, be a good two-way centerman or winger — wherever they throw me.”

Leschyshyn, who watched the win over Dallas from the press box, said he has spoken with Gallant and general manager Chris Drury about what their expectations are for him. “It’s pretty much just to be good on the forecheck,” Leschyshyn said. “Be available for the penalty kill and just be solid two-way.”

More Rangers