SAN DIEGO — During a quiet moment in the middle of the madness, with the National League clubhouse bustling with activity, Mets manager Terry Collins was asked when he would begin having some fun.

“At about 5:15,” he said, quoting the local start time of the All-Star Game.

Yet, when the time came, a gorgeous midsummer evening had been transformed into a cold autumn night. The American League beat the National League, 4-2. And while it was the All-Star farewell of Red Sox star David Ortiz that provided the most lasting memory, it was the Royals who shaped the outcome, leaving Collins on the losing side.

Just as it was in October.

Eric Hosmer homered and had two RBIs and Salvador Perez hit a two-run shot off former teammate and NL starter Johnny Cueto, giving the AL a 4-1 lead in the third and setting the tone for the evening.

Despite having Collins at the helm — a right earned when the Mets won the NL pennant — not a single Met appeared in the game. Indeed, the Mets were the only NL squad not to have one of their players participate.

In the eighth inning, Collins went with Fernando Rodney and Kenley Jansen, leaving closer Jeurys Familia in the bullpen. Bartolo Colon, the only other active Met, was saved in case of extra innings that never came.

The Yankees’ Dellin Betances tossed a scoreless seventh and Andrew Miller did not allow a run in two-thirds of an inning despite allowing two hits and a walk.

Carlos Beltran went 0-for-1, joining David Cone as the only All-Star to represent both the Mets and the Yankees.

However, the night belonged to Ortiz, who has proven himself to still be a threat at age 40.

During a pregame ceremony that featured the naming of the NL batting title after Padres legend Tony Gwynn, and an appearance set to his familiar Hell’s Bells by closer Trevor Hoffman, Ortiz received one of the warmest ovations.

Before the game, Marlins ace Jose Fernandez told ESPN that he intended to give Ortiz a sendoff by grooving three straight fastballs down the middle, even if it meant tossing them over at 90 mph “so there’s no chance that he fouls them or misses them.”

Fernandez said that he had given Ortiz a preview of his plan on Monday, saying simply, “I want to watch him hit a home run.” But when the moment of truth arrived, the Marlins ace called somewhat of an audible.

Fernandez started Ortiz with a changeup, before throwing heaters that roared at 95 mph, none of them down Broadway as Adam Wainwright is widely believed to have done for Derek Jeter in the Yankee star’s last All-Star Game in 2014.

“We’re going to discuss that later,” Ortiz said during a 20 minute media session, during which he praised the game’s brightest young stars.

Ortiz took a curveball for ball four, jogged to first base, then began his exit from the stage. When Edwin Encarnacion entered as a pinch runner, Ortiz raised his batting helmet to acknowledge the ovation from the crowd.

On the mound, Fernandez laughed, as if to blame the pitch selection on his catcher, Buster Posey.

“He basically looked at me and said, ‘It’s the catcher’s fault, he called it,’” Ortiz said.

The American League dugout emptied to greet Ortiz on the field as the National Leaguers offered a round of applause. He was embraced by the likes of Mike Trout, and the rest of the new generation that Ortiz called “the face of baseball.”

“That tells me that this game is in unbelievable hands,” Ortiz said. “With a great future.”