New York Mets manager Buck Showalter left, relieves starting pitcher...

New York Mets manager Buck Showalter left, relieves starting pitcher Chris Bassitt center, in the third inning of a baseball against the Atlanta Braves Sunday, Oct. 2, 2022, in Atlanta.  Credit: AP/Hakim Wright Sr.

ATLANTA — The Mets, the wire-to-almost-wire leaders of the NL East, are on the precipice of having to settle for a wild-card spot.

They got swept by Atlanta, punctuated by a 5-3 loss Sunday night, a stunning series of events in a game and a series that totally turned the division picture. A weekend that began with the Mets looking to clinch a division title on their rival’s home field — and owner Steve Cohen, standing on that field, saying “Let’s see if we can finish it” — ended with practically the opposite: Atlanta now has a magic number of one.

“They just flat-out beat us this weekend. They did,” Pete Alonso said. “They played well. Good for them. Tip your hat . . . I thought we played well. They just played better.”

Manager Buck Showalter said: “They pitched a little better than we did and they swung the bats a little bit better . . . They beat us one more time than we beat them this year. Our guys are having a good year. It didn’t work for us the last three games.”

And Francisco Lindor: “It doesn’t feel good.”

The next loss by the Mets, who host the Nationals this week, or the next win by Atlanta, which visits Miami, will eliminate the Mets from NL East contention. They will claim the division championship only if they win their final three games and Atlanta loses its final three.

No matter what, though, the Mets still are going to the playoffs for the first time since 2016. If it indeed is as a wild card, they will host a best-of-three series against a team to be decided. Those games would be on Friday, Saturday and Sunday, if necessary.

The Mets now have been out of first place for four days this year: the past two, plus two the entire season before that.

“What I’ve reminded them and will remind them of is how good they are and how good a year they’ve had, and we’ll still get a chance to accomplish our goals regardless of what happens,” Showalter said.

More division math: Atlanta (100-59) is two games ahead of the Mets (98-61). But by virtue of taking the season series — 10-9, rallying with six wins in the teams’ last seven meetings — they have the tiebreaker in the event the clubs finish with the same record.

That is part of why the Mets’ sudden failure was so unlikely. They needed to take only one of three games in Atlanta to guarantee the tiebreaker in their favor. And they had their top three pitchers going — Jacob deGrom, Max Scherzer and Chris Bassitt, in that order.

But after the aces flopped on Friday and Saturday, Bassitt was even worse in the finale, giving up four runs in 2 2⁄3 innings. “Pretty much beat myself,” he said. The Mets’ starters had a 6.91 ERA in these three games.

Their star hitters came up small, too. Lindor and Alonso went a combined 5-for-23 (.217) with zero RBIs and zero extra-base hits.

Mark Canha went 2-for-11. Francisco Alvarez, the top prospect thrust onto this stage at age 20 in his major-league debut, was 0-for-8.

Brandon Nimmo went 4-for-12 (.333). Jeff McNeil was 7-for-13 (.538).

The Mets outhit Atlanta 27-24 in the series, but Atlanta had more extra-base hits (11-4) and more homers (7-3).

“Feel like we did a good job with getting hits,” Alonso said. “But I feel like if we get a couple more timely hits in some big spots, having quality at-bats with guys in scoring position — we can get a little bit better with that.”

The Mets started hot Sunday night, putting nine of their first 15 batters on base against righthander Charlie Morton (three runs in 4 1⁄3 innings). But they scored only three runs (two on solo homers by Daniel Vogelbach and McNeil).

Eduardo Escobar struck out looking to strand two runners in the first. Lindor struck out swinging to strand two more in the second. They had runners at the corners with none out (and two runs already in) in the third, but Morton retired Canha, Luis Guillorme and James McCann.

The key play in that sequence was invisible in the boxscore. Canha sent a slow grounder toward third, a difficult play for third baseman Austin Riley. He opted at the last moment not to touch it, hoping it would roll foul. It did, missing the third-base bag by inches.

The Mets’ fortunes had turned. Two pitches later, Canha popped out for the first out. They didn’t advance another runner past first base.

Swanson opened the scoring with a solo homer in the first inning. That completed his series trifecta, one long ball each against deGrom, Scherzer and Bassitt.

After the Mets jumped ahead in the top of the third, Bassitt lost control of his pitches — and the lead — in the bottom of the inning. He walked Ronald Acuna Jr., later hit Riley to load the bases with two outs and  walked Matt Olson to force home a run.

Travis d’Arnaud, noted ex-Met, had the big blow. He fell behind 0-and-2, took a ball, fouled off a pitch, took another ball and fouled off two more pitches. The eight-pitch at-bat ended with a curveball grounded up the middle for a two-run single and an Atlanta lead.

The Mets showed little life from there.

“If I know these guys,” Showalter said, “they’ll rebound and look to make somebody feel their pain.”