ItI am not able to find any studies comparing the energy consumption. But if we look at a paper investigating emissions directly, which one could argue is an even better proxy for sustainability than energy, it seems that although the emissions from construction for railways is more than twice as large as that from the construction of airports, on a passenger-kilometer basis, the emissions from the flights themselves dwarfs those of trains no matter what fuel source are used for the trains. The following table is from Sweden where there is a relatively large portion of hydropower used to power the trains, but it is hard to imagine any fuel mix exceeding those of flights:
The figure can be found in this report from Swedish IVA, and is based on the freely availbleavailable (although in Swedish) calculator found here.
If one was to try to convert the figures above to energy, as the paper above argues, it would be hard to imagine an energy mix that reversed the picture. If we first concentrate on the construction component, it could be argued that both construction processes have a similar emission per energy during the pre-operational phase. Thus it is hard to imaging the construction emissions for rail becoming much bigger than for air travel. Second if we look at emissions during operation, these are really then there are no current economically feasible ways to make flights significantly less emission intensive. However, it might be the the train below is for the Swedish energy mix which has 100 g CO2 per kWh. However if we look at comparisons of emissions during operations for diesel trains and flights, one needs to travel consistently at quarter-full carriages to compare to flights. So if you are on all diesel the benefit of travelling by train is not that big. But at the same time it is important to also show the authorities and the investors that people want to take the train, the likelihood is than higher that they will electrify them (which makes sense economically too as renewables are getting cheaper).
This answer also debunks the answer to this question and I would be happy if anyone could link to this answer from that question (I am short on points to do so myself).