In a solid rotation, minus Matt Harvey, it’s the rookie deGrom moving to the forefront. Or you could just call him de facto ace.

On Tuesday, he filled that role nicely, with seven dominant innings that led to a 3-1 victory over the Mariners at Safeco Field, snapping the Mets’ three-game losing streak.

The Mets are scuffling offensively to begin the second half, but deGrom made the lineup’s lapses easier to stomach for a night. Losing streak or no losing streak, deGrom (4-5) was determined to succeed.

“I just went out with the same game plan, try to get strike one,” deGrom said after allowing one run on five hits over seven innings with one walk and seven strikeouts.

“Get guys out early to try to stay in the game for awhile and I had some great plays behind me. They hit some balls hard right at people, but things just seemed to go my way tonight.”

It was a third consecutive start for the right-hander in which he lasted at least seven innings and allowed one run or less. Over that stretch he is 3-0 with a 0.86 ERA with 26 strikeouts and three walks.

“This guy is going to figure it out, and he’s going to be tough, really somebody to deal with in the future,” manager Terry Collins said. “He’s gotten his opportunity and he’s made the most of it.”

Jeurys Familia worked a scoreless eighth — receiving help from Juan Lagares, who went racing toward the center-field fence to snare Endy Chavez’s drive leading off the inning — before Jenrry Mejia got his 12th save in 14 chances.

Lucas Duda crushed a solo homer in the eighth inning to give the Mets a two-run lead. The blast was the Mets’ first in the second half and snapped a five-game drought overall. In winning eight of 10 games to close the first half, the Mets out-homered opponents 11-6.

“We’ve faced some good pitchers and we’ve been in some bigger ballparks,” David Wright said before the game. “And you’re talking about four games. I think the pace we were scoring runs, the pace we were hitting home runs might not necessarily be the type of team we are as far as the home runs go.

“If you look at the majority of the season, the pace that we were on before the All-Star break was probably somewhat unrealistic to keep up.”

Dustin Ackley’s RBI double in the fifth had sliced the Mets’ lead to 2-1. Willie Bloomquist’s single with one out started the rally.

DeGrom was tested in the first, allowing a leadoff single to Chavez, but struck out Robinson Cano and Kyle Seager in succession to escape the inning with a runner left stranded at second.

“With a lot of lefties in the lineup it was a good night to have my changeup real good,” deGrom said.

Erasmo Ramirez (1-5) was tough on the Mets in the middle innings, striking out the side in the fourth before getting Eric Young Jr. to hit into a double play in the fifth. In the sixth, Kirk Nieuwenhuis and Lagares struck out in succession to end the inning, leaving two runners stranded.

Overall, Ramirez went seven innings and allowed two earned runs on five hits with 10 strikeouts and two walks.

Travis d’Arnaud’s RBI triple in the second gave the Mets their first lead since Friday. Bobby Abreu singled leading off the inning before d’Arnaud hit a sinking line drive to center that James Jones couldn’t reach. The ball rolled behind Jones toward the fence, allowing Abreu to score easily.

Later in the inning, Ruben Tejada delivered an RBI single that gave the Mets a 2-0 lead.