A man torched the parking garage of Brooklyn’s Kings Plaza Shopping Center on Monday — incinerating scores of new Mercedes-Benzes stored there and causing millions of dollars in damage, cops said.

The massive inferno sent huge plumes of black smoke into the air as it tore through two floors of the garage, damaging 137 luxury cars, forcing panicked mall workers to evacuate and injuring 21 people, including 18 firefighters.

“I heard, ‘Boom! Boom! Boom!’ ” said local resident Mike Wright, referring to the explosion of the cars’ tires. “The next thing I know, firetrucks are coming out. I look up, and there is this huge plume of smoke all over the neighborhood.”

The seven-alarm blaze erupted on the second floor of the four-level 4,000-space garage around 8:30 a.m. and quickly spread to the third floor, shutting down the Marine Park mall before it opened to the public, authorities said.

Garage security cameras captured the arson suspect sauntering from the scene moments before the blaze broke out, cops said. The man had a T-shirt hanging over his left shoulder and pants falling off his hip to reveal Izod boxers.

Suspect Avon Stephens was later taken into custody on arson charges.

Police said Stephens is known by mall security as a homeless man who sleeps in the parking garage. Prior to allegedly starting Monday’s blaze, he had been ordered by security to leave the area, police said.

As Stephens was walked from the 63rd Precinct by police for the trip to court Monday, he muttered to reporters “I’m sorry. I apologize.”

About 250 firefighters battled the flames for nearly three hours before it was under control.

“The black, toxic smoke, the heat, the limited area firefighters had to work in all made it very difficult to quickly extinguish the fire,” FDNY Commissioner Daniel Nigro said at a press conference.

Eighteen firefighters ended up receiving medical treatment, as did three civilians. All were in stable condition, officials said.

“Our members have various levels of smoke inhalation and heat exhaustion,” Nigro said. “Working under those conditions with this amount of smoke and this amount of heat, wearing what they wear, one can only imagine what they went through.”

An FDNY source noted that the conditions were so hot that “the paint peeled off the floor. All the light fixtures were burnt, melted . . . These guys were lucky.’’

Several area car dealerships — including Mercedes, Dodge, Toyota and Nissan — use the garage for storage, employees said.

Law-enforcement sources said that of the 137 cars damaged, 132 were Benzes — or nearly all of the Mercedes-Benz of Brooklyn dealership’s garaged inventory of around 150 vehicles.

“It’s a lot of money,” said a dealership employee. “The most expensive car we have there is $126,000 and that’s the S-Class.”

The others included C-Class, E-Class, S-Class, SUVs and GLS models, which another worker said cost at least $70,000, each.

“We’re going to be hurting for awhile,” another dealership worker said.

Additional reporting by Stephanie Pagones and Chris Perez