Steven Matz #32 of the Mets pitches during the first...

Steven Matz #32 of the Mets pitches during the first inning against the Philadelphia Phillies at Citi Field on Monday, Apr. 22, 2019. Credit: Jim McIsaac

Steven Matz kept his cool and Bryce Harper lost his as the Mets beat the Phillies at Citi Field on Monday night, 5-1, in a game that was delayed 1:35 at the start by rain.

Matz, who didn’t record an out and was charged with eight runs (six earned) in his last start in Philadelphia on Tuesday, allowed one run in six innings on Monday.

Matz’s task was helped by the absence of Harper after the fourth inning. The Phillies’ $330 million man was ejected by plate umpire Mark Carlson for arguing balls and strikes from the dugout.

Harper had been called out on strikes to start the inning on a pitch he thought was high. He apparently kept barking at Carlson from the dugout and was ejected four batters later after a strike call to Cesar Hernandez.

Harper raced out of the third-base dugout and had to be body-blocked away from Carlson by Phillies manager Gabe Kapler— but not before Harper appeared to make contact with the umpire, which could lead to a suspension for baseball’s highest-paid player.

Harper was replaced in the lineup by Roman Quinn, who came into the game with two hits in 16 at-bats this season.

“It just can’t happen,” Harper said of getting tossed. “In a game like that against the Mets, division rival, things like that, it just can’t happen. For myself and this team as well. We’re a better team with me in the lineup and I’ve got to stay in there.”

Said Carlson: “He made some comments in the dugout that were inappropriate that caused his ejection.” Carlson also said his report will indicate that Harper bumped Kapler into him.

The fourth inning was meaningful for Matz for other reasons. The Mets were leading 2-0 thanks to an RBI double by Pete Alonso and a run-scoring single by Wilson Ramos in the third inning against Jake Arrieta (3-2).

After Matz struck out Harper to open the fourth, Rhys Hoskins hit a long homer to left-center to make it 2-1.

Matz, who has a history of losing focus when things go south, walked Maikel Franco on four pitches and fell behind Phil Gosselin 2-and-0.

Ramos came out for a visit and was joined at the mound by Todd Frazier, who was making his season debut after being activated from his rehab assignment.

Whatever the veterans said must have clicked for Matz, who threw six straight strikes to Gosselin (three were fouled off) before retiring the Phillies’ shortstop on a liner to center for the second out.

Then came the Hernandez at-bat, during which Harper was ejected. After order was restored, Hernandez singled to put runners at first and second, but Matz got Aaron Altherr on a grounder to Frazier to end the inning.

“Ramos, his catcher, helped him out,” manager Mickey Callaway said. “That’s what teammates do.”

Jeff McNeil homered with one out in the fifth to give the Mets a 3-1 lead. It was McNeil’s first home run of the season.

Matz (2-1) finished having allowed three hits, walking two and striking out six in the bounce-back outing the Mets craved.

“I didn’t give [the previous outing] too much weight, honestly,” Matz said. “I did watch video a little bit after, but after that, no. Knowing the platform I had going into today, I had three good starts and one bad one. I just don’t give it too much weight and just stay the course, honestly.”

The Mets scored two more runs in the seventh as McNeil and Alonso were hit by consecutive pitches by two different pitchers.

First, McNeil was hit on the right hand by lefthander Jose Alvarez to load the bases. Alonso was hit on the left shoulder on the first pitch thrown by righthander Juan Nicasio to force in a run. Michael Conforto followed with a sacrifice fly and it was 5-1.

McNeil had an X-ray after the game, but said he was fine. The Mets were, too, as they moved into a first-place tie with the Phillies in the NL East. Both teams are 12-10.

With David Lennon and Laura Albanese