In the altar room you will see an open door with a raised gate above it, you'll need to lure the dragon into that doorway to kill it. The dragon is attaking Leanna, you'll need to draw it's attention to you. Walk in between Leanna and the dragon and hit it with your sword when it's low, with a spell or with an arrow, anything to make it focus it's attacks on you. When that's done move into the open doorway and wait for the dragon to put it's head in the opening. Pull the lever to close the gate on its head to kill it.