Madison Square Garden boss James Dolan was so furious with a security guard who didn’t recognize him outside the swanky Delta Sky 360 Club that he fired her right on the spot, sources told The Post yesterday.

But the hothead exec had a change of heart overnight — and the guard was back at her post the very next day, sources said.

Dolan, 57, was walking into the exclusive club during Sunday’s Knick game against the Boston Celtics when security guard Fiordaliza Hernandez asked him for his ID — which he never wears, sources said.

Instead of laughing it off, Dolan snapped, “Do you know who I am?”

The startled security guard admitted she didn’t.

Then Dolan demanded, “How long have you worked here?”

Three years, the guard said.

“I’m your boss! I pay your salary!” Dolan shot back.

But rules are rules — and Dolan didn’t show his ID, so Hernandez refused to let him in, sources said.

That’s when Dolan became so angry he yelled: “Give me your ID! You’re fired!”

The stunned guard was sent home immediately.

“I have to get new security in this building! I have idiots working here!” Dolan ranted, sources said.

But the MSG honcho quickly reconsidered his decision, and last night, Hernandez was back on the job at a different post as the Rangers played the Winnipeg Jets.

“What? Was he insulted she didn’t recognize him?” an incredulous source said.

“If she let someone in without a ticket or Garden ID, she would have gotten fired for that!”

While Dolan blew his top over the security guard, last week three ticket holders walked right into the Knicks’ locker room without being stopped by security — and nobody was fired for that lapse, sources said.

Hernandez couldn’t be reached for comment yesterday.

MSG spokeswoman Kim Kerns said, “As a company policy, we do not comment on employee matters.”

But a source close to Garden brass claimed, “Nobody was fired.”

Dolan’s posh Delta Sky 360 Club is open only to season-ticket holders and VIP guests — and features food from the restaurants of celebrity chef Jean-Georges Vongerichten and a glass-enclosed walkway that lets guests watch players walk out of the locker rooms.