You cannot actually gather usable energy from heat directly (that's a law of thermodynamics). You need a heat differential. The movement of heat from a hot reservoir to a cold reservoir is required in order to actually gain energy.
There are many ways to build a heat-engine to transfer heat from hot to cold in this way, but I would recommend two processes.
The first is for use in the lair. While in the lair, you have limited access to cold objects to transfer heat to. However, the lair itself is going to have some heat differential from top to bottom. We can leverage that. In fact, the dragon may intentionally make the top of their lair cooler (by adding things like metals to conduct heat to the surface... and Gold just happens to be a very good heat conductor). This won't generate much energy, because the temperature differential is minimal within the lair. However, it could generate enough energy to keep the dragon alive and functioning if they have to stay in their lair for long periods.
The second approach is neater. Some reactions favor one direction or another at different temperatures. For example, CaO(s)+H2O(l)⇌Ca(OH)2(s)+heat, the conversion of quicklime to slaked-lime, is tremendously exothermic. It's a great energy source. However, at high temperatures, the reaction reverses, taking slaked-lime and converting it to quicklime and water. You can use this to form a heat engine within your dragon. While it is in its lair, it stores slaked-lime in its body, which gets converted naturally into quicklime. Later, when the dragon emerges to fly, needing substantial energy to stay in the air, it can decrease the temperatures of these quicklime stores (using the outside air to cool them), and convert them back to slaked-lime using an enzyme which captures the energy of this conversion rather than just wasting it as heat.
This energy is now in a "usable" form, so can be used immediately or stored in compounds which can be used for metabolism both inside the lair and outside, and can be used on a moment's notice (if your dragon doesn't have time to air-cool a bunch of quicklime)
I'm not sure if the slaking of lime will be an acceptable reaction for you (it's hard to tell if dragon metabolism can balance that equation correctly for volcanic temperatures), but it's an example of the kind of reaction which lets you draw energy from the volcano.