Gardiner won in a 43.48 seconds, making him the sixth-fastest 400 metres runner in history, as he went one better than the silver medal he claimed in London two years ago.
Colombian Anthony Zambrano produced a surge down the final straight as he charged from fourth to second to snatch the silver and leave American Fred Kerley, one of the pre-race favourites, with the bronze after an enthralling race.
Kirani James of Grenada, the former world and Olympic champion who has made a comeback this year after being plagued by injury for several seasons, finished fifth.
Kerley was fastest out of the blocks but Gardiner closed the gap, found another gear around the second bend and accelerated away to finish 0.67 seconds ahead of Zambrano.
"Hurricane Dorian was very devastating for my family and my island," Gardiner told reporters.
"I just wanted to come here to do my best. My friend and my family wanted me to perform, I was able to bring home a medal for my country. I just wanted to go there and make our country proud."
Hurricane Dorian slammed into the Bahamas on Sept. 1 as a Category 5 storm, one of the strongest Atlantic hurricanes on record to hit land, causing widespread devastation and killing at least 50 people.
Gardiner, 24, has said that he lost two houses in the storm and his training was interrupted for several days.