Why have the dwarves built a convenient cliff edge into their underground city, why are they sending their golems to fight next to it, and why does the room it's in have enough space for an ancient dragon to get airborne?
So, it's your assumption that the dwarves totally control any battle?
The dragon should be picking and choosing it's fight locations, not the other way around. Granted, the dwarves do have murder holes, traps, and other such defenses, but it takes a lot of effort to kill the dragon, it takes little effort to kill hundreds of dwarves.
From every fantasy novel, movie, and RPG that I have ever seen, underground dwarven kingdoms have large open areas, magnificent cathedrals, overhead bridges and pathways. Dwarves also build their cities in mountains.
So from outdoors, all defenders (golems and hero dwarves alike) can be grabbed and dropped. It's outdoors in the mountains.
From indoors, the dragon can use these tactics wherever there is a larger height or indoor cliff or whatever.
If you design your dwarven holds such that it is mostly a warren of small passageways, then sure, it makes it difficult for the dragon to move easily. But for such occurrences, the dragon should just cave in and demolish the entrance ways, trapping or at least hindering the dwarves in them from attacking. He can always starve them out and/or send in his own minions later on to search.
But golems? Against an ancient dragon with an Int of 18? No contest.