BOSTON — Ever since David Ortiz announced his intention to retire last November, the Red Sox coalesced around a singular goal.

“Everybody had it mapped out in their head in spring training what we wanted to do,” Clay Buchholz said Saturday, “knowing that David was not going to be here next year.”

While the Red Sox were able to give the veteran designated hitter a division crown, they were unable to take it any further.

Though heavily favored against the AL Central champion Indians, Boston’s vaunted offense, Ortiz included, never got it going. The Red Sox, though they inserted some drama late, were swept in three games, capped by a 4-3 defeat to the Indians on Monday night in front of 39,530 at Fenway Park.

The Indians will play the Blue Jays in the ALCS, which starts Friday in Cleveland.

The 40-year-old Ortiz, in his final game, went 0-for-1 with a sacrifice fly and two walks.

advertisement | advertise on newsday

With the Red Sox trailing 4-2, he came up with a runner on and two outs in the eighth against Cody Allen, the Indians’ closer.

Allen didn’t come close to giving Ortiz a pitch he could hit, walking him on four pitches. He then fell behind Hanley Ramirez 2-and-0 before the first baseman lined an RBI single to left, which scored Travis Shaw, who singled earlier in the inning against Bryan Shaw.

Marco Hernandez came in to pinch run for Ortiz, who left the field to a huge ovation. Xander Bogaerts then stung a liner but right at second baseman Jason Kipnis to silence the crowd, keeping it a 4-3 game.

Allen retired the first two batters of the ninth before Jackie Bradley Jr. hit a bullet to right for a single. Up came leadoff man Dustin Pedroia, who got ahead 3-and-1. Pedroia swung at a high-and-outside fastball to make the count full, then took a fastball outside to put two runners on for Travis Shaw.

Allen fell behind the lefthanded-hitting Shaw 3-and-1 before getting him to fly softly to right on the 40th pitch of his 1 1⁄3-inning appearance.

Baseball videos

The crowd bust into a “Papi! Papi!” chant as the Indians, qualifying for their first ALCS since 2007, celebrated on the field.

The Indians built a 4-1 lead on a two-run single by rookie Tyler Naquin in the fourth, which made it 2-0, and a two-run homer in the sixth by former Red Sox Coco Crisp that pushed the lead to three runs.

Buchholz, 8-10 with a 4.78 ERA this season but 4-0 with a 2.63 ERA over his last seven starts, allowed two runs and six hits over four innings. Boston starters Rick Porcello, David Price and Buchholz lasted 4 1⁄3, 3 1⁄3 and four innings, respectively.

Indians righthander Josh Tomlin, a fly-ball pitcher prone to giving up homers (36 in 29 starts this season), was mostly terrific. He allowed two runs and four hits over five-plus innings.

After Pedroia led off the sixth with a single, Cleveland manager Terry Francona, who won World Series titles with the Red Sox in 2004 and 2007, went to Andrew Miller. The lefthander, who pitched two scoreless innings after being inserted in the fifth inning of Game 1, struck out pinch hitter Aaron Hill. But Mookie Betts followed with a towering drive off the top of the Monster, the double putting runners at second and third for Ortiz. The DH delivered Pedroia with a sacrifice fly to center, making it 4-2.

advertisement | advertise on newsday

Miller, who had a 1.55 ERA in 26 appearances with the Indians after they traded for him from the Yankees, struck out Ramirez to end the inning. Miller allowed one hit, a walk and struck out three in two innings.