LOS ANGELES — Michael King did his best to show a member of the Padres’ starting rotation could still contribute in a meaningful way and help keep the team contending.

The Padres’ offense built a three-run lead by scoring in the first, fourth and sixth innings against Shohei Ohtani.

Then King tired in the seventh inning, and the unraveling of the Padres’ season continued.

An error by one of their best fielders preceded a grand slam against one of their best relief pitchers, and that was that.

Two innings later, a 4-3 Dodgers victory was completed and the Padres had lost their seventh consecutive game and were officially a sub-.500 team.

They did not reach base against Edgardo Henriquez in the eighth or Tanner Scott in the ninth, meekly finishing off their 26th loss in the 40 games since they beat the Dodgers on May 18 to move into first place in the National League West.

The Padres were 29-18 at that point. They are now 43-44.

King’s outing was the first in seven games by a Padres starting pitcher that lasted longer than 4⅔ innings. It was the first time in 10 games that a Padres starter made it through six innings.

King began the seventh by walking Mookie Betts and yielding a single to Max Muncy.

Adrian Morejón came in to face Kyle Tucker and got him to hit what seemed to be a double-play grounder to second baseman Jake Cronenworth, who hurried a bit too much and had the ball come out of his glove as he went to transfer it to his hand.

Teoscar Hernández hit the next pitch, a slider over the center of the plate, over the wall in left-center field.

Dodger Stadium shook for several seconds.

It will take some kind of mettle for the Padres to not be irreparably shaken by what has occurred this week.

Friday was hardly a tremor when compared with a 23-3 loss Wednesday that concluded the Cubs’ three-game sweep at Wrigley Field and a 12-7 loss here on Thursday after the Padres had taken a 6-0 lead two innings in.

Friday didn’t begin that well. But it was an excellent showing against Ohtani, who shut them out over five innings last month and entered the game with a 1.58 ERA.

The Padres scored the first run Ohtani surrendered in the first inning this season when Fernando Tatis Jr. and Cronenworth walked to start the game and Gavin Sheets drove in Tatis with a one-out single.

That hit also got Cronenworth to third, where he was stranded when Ty France and Jackson Merrill struck out.

All three pitches to Merrill were fastballs — the first and last at 100 mph, the middle one at 101.

Ohtani threw 29 pitches in the first and then retired the next eight batters on 34 pitches before Merrill came up with two outs in the fourth and homered to center field on a 100 mph fastball — on a 2-0 pitch that immediately followed Merrill winning an ABS challenge.

The Padres scored in the sixth on a two-out single by Merrill and Xander Bogaerts’ double.

King got through MLB’s most dangerous lineup in 30 pitches and without anyone reaching base before allowing his first hit — a two-out single by Freddie Freeman — in an eight-pitch fourth inning.

Against the Dodgers five days earlier at Petco Park, King navigated four innings having allowed a run on two hits and thrown strikes on nearly three-quarters of his 61 pitches. Then, in his words, he “fully lost it.”

He retired one of the six batters he faced, walked three, hit one and allowed a single as the Dodgers scored three runs and ran him from the game.

On Friday, King struck out two and added just 12 pitches in a 1-2-3 fifth inning and was at 68 pitches after stranding runners at first and second in the sixth.