LOS ANGELES — A season of fits and starts hit another snag on Wednesday night, the Dodgers sputtering out of the gate during a shaky first inning that set the tone for a 6-1 loss to the New York Mets before a crowd of 45,733 in Chavez Ravine.

Pete Alonso capped a three-run first inning with a two-run homer to right-center field off Dodgers starter Tony Gonsolin, and the Mets slugger crushed a 447-foot, three-run shot to left-center off reliever Ryan Loutos in the eighth to put the game out of reach.

Mets right-hander Griffin Canning, a former Angel, gave up three hits over six scoreless innings with seven strikeouts and one walk to earn the win, continuing a resurgent season in which he is 6-2 with a 2.90 ERA in 12 starts.

The Dodgers, meanwhile, failed to build on the momentum they generated with Tuesday night’s 6-5, 10-inning comeback win over the Mets, advancing only one runner to third base before Andy Pages hit a one-out solo homer in the bottom of the ninth.

They are still in first place in the National League West, their 37-25 record keeping them a game ahead of the San Diego Padres, but they are 29-25 since their blistering 8-0 start and have not won more than three games in a row since the beginning of May.

Of course, it hasn’t helped that the Dodgers have three front-line starting pitchers (Blake Snell, Tyler Glasnow, Roki Sasaki) and four top relievers (Blake Treinen, Evan Phillips, Michael Kopech, Kirby Yates) on the injured list.

“Teams win consistently by preventing runs, and it’s hard to do that when you’re piecing together a pitching staff,” manager Dave Roberts said. “For us, it’s getting a quality start and good innings out of the bullpen.

“We haven’t been able to do that for the last few weeks, and that’s the reason we’ve played .500 baseball.”

The Dodgers made a mess of the first inning Wednesday night, Gonsolin hitting leadoff man Francisco Lindor in the right foot with a pitch and second baseman Kiké Hernández allowing Brandon Nimmo’s potential double-play grounder to roll under his glove for an error that put runners on first and third with no outs.

Juan Soto grounded out to second, Lindor scoring for a 1-0 lead, and Alonso drove a first-pitch 86-mph slider on the outer half of the plate over the right-center field wall for a two-run home run — his 13th of the season — and a 3-0 Mets lead.

Gonsolin rebounded from his rocky first inning to blank the Mets on two hits over the next four innings, which resulted in a respectable line score of five innings, three runs — two earned — three hits, six strikeouts and three walks.

But Canning was better, shutting down a Dodgers offense that entered Wednesday leading the major leagues in runs (352), home runs (100), batting average (.267), slugging percentage (.469) and OPS (.812).