MIAMI >> Every seven years or so, the Dodgers come to Miami and one of their pitchers flirts with a perfect game.

On Sept. 10, 2016, it was Rich Hill. He retired the first 21 Marlins batters in order before rookie manager Dave Roberts pulled him from the game out of concern for a blister issue that had landed Hill on the injured list for more than a month that season.

“I feel sick to my stomach,” Roberts said of the decision that night, lamenting that he felt he had to take “an opportunity of a lifetime” away from Hill to protect larger goals.

Ryan Pepiot had his opportunity Thursday night. Pepiot retired the first 20 batters he faced before allowing a single, finishing with seven scoreless innings as the Dodgers avoided a sweep with a 10-0 victory over the Marlins.

“It was like the fifth inning,” Pepiot said of realizing he had a perfect game going. “When I finished the fifth, no one was talking to me anymore. Then I looked up and saw the zero.

“Everyone was sliding by me, and then no one would sit anywhere near me.”

The Dodgers left Miami with a win — but some concern over Mookie Betts.

Betts left the game early after fouling a ball off his foot during his first-inning at-bat. Betts played through seven innings, reaching base four times. X-rays were negative, but Betts was on crutches as he left the stadium.

Pepiot was in Texas with Triple-A Oklahoma City, scheduled to pitch out of the bullpen on Tuesday when he was told he wasn’t pitching that night but might be pitching Thursday for the Dodgers. Julio Urias was placed on administrative leave while MLB investigates his arrest for a domestic violence incident. So Pepiot was recalled from the minors Thursday — though he hasn’t actually pitched there since Aug. 13 while going on and off the Dodgers’ active roster — and took Urias’ spot in the rotation.

In that last start with Triple-A Oklahoma City nearly a month ago, Pepiot also completed six perfect innings before giving up a hit in the seventh.

“It was really fun to watch,” Roberts said of this near-perfect game. “Command all night. Strike one. Pitch efficiency, pounding the strike zone. Austin (Barnes) was fantastic with him. A lot of weak contact. You could see guys trying to get in and out of the at-bat. Didn’t walk anybody.

“We were all pulling for him. Unfortunately, Josh Bell snuck one through.”

Soft contact and Amed Rosario were the best weapons in Pepiot’s arsenal against the Marlins. He struck out just two of those first 20 batters (both in the first inning), but Rosario kept the perfect game going with a pair of outstanding defensive plays.

The second baseman ran down Jake Burger’s ground ball to his left in the fourth inning and threw him out. Then in the seventh, Rosario leaped up to grab a line drive by Luis Arraez that was headed to right field.

Two batters later, Bell lashed a clean single through the middle of the infield to end the perfect game bid — and save Roberts from the dilemma of pulling a pitcher from a no-hitter for the sixth time in his managerial career (fifth inning or later). Pepiot’s pitch count wasn’t going to do it for him. The right-hander got through his six perfect innings on just 65 pitches and left after 84 pitches in seven innings.

“I was gonna give him every opportunity to finish that game if it was a no-hitter, let alone a perfect game,” Roberts said, admitting to some flashbacks to Hill’s game. “He’s big, he’s physical. He was staying in his delivery. He didn’t have blood dripping from his finger. I didn’t have trainers telling me to take him out of the game.

“So ... it was his game.”

The Dodgers’ fifth starter as they were breaking camp this spring, Pepiot suffered an intercostal strain in his rib cage and didn’t pitch for three months. He has made four appearances for the Dodgers now and hasn’t allowed a run in 12 innings over two starts.

“I think his ability to go to both sides of the plate is what’s kind of different right now,” Barnes said. “He had trouble going glove side a little bit. It was kind of taking off (last year). But his ability to go to both sides of the plate now is really helping him through this little stretch right now.”

This little stretch comes at a fortuitous time both for Pepiot and a Dodgers team desperate for reliable starting pitching that could step up in October.

“Obviously, when things happen that are unforeseen, it creates opportunities for others. I’m sure he’s well aware of that,” Roberts said. “But to continue to just stay focused on the job at hand, because if you don’t, then the conversation’s moot. To his credit, he’s going out there and opening a lot of eyes. Most importantly, he’s got real confidence now to get major-league hitters out consistently.”

Pepiot acknowledged that it would be “pretty incredible” to pitch for the Dodgers in the postseason after the way his season started.

“I mean, that’s always in the back of your mind,” he said. “But at the same time, it’s just compete wherever you’re at. Just take the ball when they tell you to take it, whether it’s starting or in the bullpen or whatever it is, and just go out there and give the team the best chance to win and try to take down some innings and save the guys.”

Chris Taylor had his own big day on Thursday.

Taylor drove in five runs with a single, a double and a three-run home run, helping the Dodgers break the game open after a slow start offensively.

During a four-run sixth inning, Freddie Freeman tied the franchise record with his 52nd double of the season — with an assist from the ball boy down the right field line who mistakenly fielded Freeman’s ball in play and tossed it into the crowd. The umpires awarded Freeman a double and ruled Betts would have scored from first on the play.