ATLANTA — Tommy Pham replaced Pete Alonso in the cleanup spot and played the role as cast. However, the rest of the game didn’t go according to the script.

The Mets avoided the worst with Alonso but failed to avoid the worst in this series. For the second night in a row, the Mets went up 4-1 on the Atlanta Braves before falling behind, 5-4, and ultimately losing, 7-5.

With two out in the bottom of the eighth, Michael Harris II teed off on Adam Ottavino sending a two-run homer over the wall to hand the Mets (30-32) their fifth straight loss and their second straight series loss.

“Threw it right down and in, in the zone,” Ottavino said. “A really poor location for me. I regret it.”

For the second night in a row, the Mets went up 4-1 on the Braves (37-24). This time, they went up 2-0 before Max Scherzer gave up a run in the fourth and two runs in the fifth.

Alonso was removed from the game with what the team is calling a “left wrist contusion,” after being hit on the left wrist with a 97 MPH fastball from Charlie Morton in the first inning. He left the game to undergo imaging Pham replaced him in the batting order and went 1-for-2 with a two-run home run and three RBI.

The outfielder’s two-run homer off Morton in the fifth momentarily gave the Mets a 4-1 lead and he tied the game with a sacrifice fly in the seventh.

Pham came up with the bases loaded and one out. He stared at the first four pitches from Kirby Yates before fouling one off and working the count full. On the seventh pitch of the at-bat, Pham launched a towering fly ball toward the right-center field wall. Somehow, Ronald Acuna Jr. came up with the ball after making a spectacular leaping catch.

The fly ball scored Brandon Nimmo to tie the game at 5-5.

“Tommy — unbelievable day,” Alonso said. “He had great quality at-bats, he filled right in, a sac fly and a big homer. He stepped right in and filled the four-hole role great. He did a great job.”

It remained tied until the eighth. Brooks Raley started the inning and was charged with the loss after his baserunner scored on Harris’ homer. He was removed after giving up a double to Marcell Ozuna. The Mets played it conservative by pulling Raley after giving up hard contact, but it was a gamble to throw Ottavino on back-to-back nights.

A.J. Minter recorded the save with a perfect ninth.

“We have good people down there who are capable of doing the job and have done it for us at times this year,” Showalter said of his bullpen, which owns a 4.17 ERA (tied for 20th in MLB). “We’ll get back on track. It’s not easy getting those guys out.”

No lead is safe against the Braves. In the bottom of the fifth inning, Sean Murphy hit a two-run homer off Scherzer to bring the Braves within one run. Atlanta rallied with two outs to score two more in the sixth to chase Scherzer out the game after five earned runs on 11 hits and a season-high 10 strikeouts.

“That’s a very tough lineup to go through like he did a few times,” Showalter said. “He gave us a great chance to win. It’s hard to go through that lineup. We had 2-3 guys down in the bullpen today, so we were hoping to get through that sixth inning because it would have set us up to pitch that last three innings there. A pitch away. Just wasn’t able to completely execute what he was trying to do.”

This was Scherzer’s 111th double-digit strikeout game. The veteran right-hander surpassed Roger Clemens for third all-time in double-digit strikeout games, with Randy Johnson (212) and Nolan Ryan (215) still well ahead of the rest of the field. Right after Scherzer logged that 10th strikeout, the hard hits came.

“Tonight was kind of a weird night,” Scherzer said. “I did a lot of things right. I didn’t walk anybody, I had a lot of first-pitch strikes and I used all of my pitches and everything was working. But later in the game, typically you win and lose ballgames on your last 15 pitches… You just want to execute better in those situations and I didn’t.”

Scherzer exited after 5 and 2/3 innings. Neither starter factored into the decision, with Morton leaving after 4 and 2/3.

“We’re fine; we’re competing,” Scherzer said. “This is Major League Baseball. This is what happens. You want to go out there and be the best, there [are] times you’ve got other times ready to beat you. Every single day is a new day. We’ll go out there tomorrow. We got out there and we’re going to win tomorrow.”

()