The Brooklyn man who burst out of a burning building engulfed in flames after his basement exploded Tuesday afternoon has died, authorities said.

Mohammad Saram, 22, was making flavored tobacco for hookah pipes when a container of highly-flammable acetone ignited in the poorly-ventilated basement of 910 McDonald Ave., causing a flash fire around 1:30 p.m.

Saram was rushed to Maimonides Medical Center in critical condition and succumbed to his injuries Wednesday morning, officials said.

It’s unclear exactly what ignited the acetone.

Saram’s brother, who preferred to remain anonymous, was devastated by his brother’s death.

“I’m feeling really depressed,” he told The Post. “Everyone’s just really sad right now, it feels like a fake day.”

His sibling was planning to study at John Jay College of Criminal Justice in January, he added. Neighbors said the Bengali man wanted to open a hookah bar.

Witness Alex Mayer, 36, heard the explosion and dropped the phone in his hand to run outside when he saw a man ablaze running through the street.

Mayer repeatedly yelled for him to “drop and roll” at the top of his lungs, he said. The man on fire listened and rolled into a gutter.

Soon after, others jumped in to help him fight the flames.

“One guy came out of the truck with his fire extinguisher and sprayed his sneakers,” Mayer said. “And another guy literally grabbed the shirt off his back.”

The badly burned man kept screaming for help as they waited for cops to arrive.

“I don’t know if he was bald or not but he definitely didn’t have any hair left now,” Mayer said. “His lips were white. A lot of his clothing melted.”

When cops showed up, they found the man unconscious.

Containers filled with chemicals used to make flavored tobacco for hookahs were found at the scene, and investigators believed that caused the fire because the basement was not well ventilated, sources said. Neighbors said the Bengali man wanted to open a hookah bar.

“The fire department units extinguished the fire and right now at this time we have hazmat units are testing some unknown chemicals found in the basement,” Acting Division 8 Battalion Deputy Chief Mark Egan said.

One firefighter suffered minor injuries while battling the blaze.