A “heroic” security guard suffered an excruciating death, being burned alive in an elevator on Christmas while trying to prevent an arson fire from spreading throughout a Queens apartment building.

The blaze inside a garbage cart that killed 32-year-old Raymond James was set by two 13-year-old boys, whom police charged with murder yesterday.

James had tried to take the burning cart out of the building in the Arverne section of Rockaway by bringing it downstairs in an elevator, but the fire accelerated, trapping and killing him in the car, authorities said.

Chief Fire Marshal Louis Garcia called James “a selfless, heroic individual who was trying to save lives of people in the building.”

“It’s a tragedy that this man died on Christmas Day,” Garcia said. “I feel terrible. We feel for the family. It’s unbelievable.”

At about 8:50 p.m. Saturday, James was working an overtime shift at an 11-story apartment building at 146 Beach 59th St. As part of his duties, he would ride the elevator from the top floor down, collecting garbage from bins left out on each floor, authorities said.

At the same time, two boys who live in the building – 13-year-old cousins – were walking around setting fire to Christmas decorations on the doors of residents’ apartments, authorities said.

On the fifth floor, one resident heard a commotion and opened his door.

“I looked down the hall, and I saw two kids lighting the trash cart. When they saw me they started running. I chased after them and caught one of them” outside the building, said the 26-year-old resident, who refused to give his name, but who said he turned the boy over to other security guards.

As the man chased the boys, James arrived on the fifth floor to find the garbage bin ablaze.

When James pulled the burning garbage bin into the elevator, and the doors closed, leaving him and the bin inside, the fire swelled, and spilled over onto him, totally immersing his body in flames, authorities said.

He died quickly, and his charred body was found by security guards on the first floor when the elevator doors opened.

James left behind four young children and a wife of three years, Laverne, who, in a voice choked with tears, said that his last words to her in a Christmas phone call on his way to work were “I love you.”

Those same words are inscribed on the bracelet that James, a recent immigrant from St. Vincent and the Grenadines, gave her as a gift that day in their Richmond Hill home.

“I’m just a little sad,” said James’ 6-year-old son, Anthon, pointing to an unwrapped gift to his dad from a cousin under the family’s Christmas tree. “That’s his present. He hasn’t opened it. It has his name on it. He never got it.”

James, who had spent a decade working as a cop in St. Vincent, was working a security-guard job and watching his kids during the day so that Laverne could attend school to become a medical assistant.

His paycheck also helped pay for the mortgage of Amabella James, his mother in St. Vincent, who said he had called her on Christmas Day to say, “Mommy, I love you. If it hadn’t been for you I would not be here.”

The two boys – identified by the city as Derrick H. and Curtis H. – were arrested yesterday and charged with arson and second-degree murder in James’ death. It is expected that the boys will appear in Family Court today.

“They’re good kids,” insisted one of about a dozen upset relatives and friends of the boys who watched them being transferred from the 101st Precinct stationhouse yesterday afternoon. “It was an accident. Bad things happen. They aren’t murderers. They don’t run around with guns.”

James’ wife said he had been trying to get a job in Manhattan because he disliked working in the Rockaway building.

“He was not happy in that environment. It’s a violent area. The people had no respect for authority, and he was threatened once,” said Laverne James, who immigrated to the U.S. 16 months ago with her husband.

She said that in addition to the 6-year-old boy and 9-month-old girl that James had with her, he had two other kids, a 9-year-old girl and a 6-year-old boy, from a prior relationship with another woman who lives in St. Vincent.

“What are me and the other mother going to do?” said Laverne, breaking down into tears.