If a town gets popular among rich tourists and supply remains limited, the tourists will price out the locals (as is already apparent)
Zoning/limiting the number of airbnbs in proportion to the the total housing stock can be one solution to stop the tourist industry from gobbling everything else up (at the expense of the tourist economy)
Not an economist, but an extreme solution to achieve 100% efficiency, i.e occupancy would be for everyone (including locals) to become nomads and be willing to move homes everyday based on daily spot rates for housing and take up any unoccupied house that day based on what they can afford. (I.e a combined market where tourists and locals both live the hotel/Airbnb lifestyle). Sounds horrible though.
The apparent inefficiency (in terms of unnoccupied rooms/houses) IMO arises from the very real inconvenience and costs involved in moving houses too frequently. Contrast that with tourists who want to definitely want to stay in a city only for a few days. The two classes will always compete without intervention that favors one over the other - or tries to find some arbitrary balance
They would then say that the local wages will eventually increase to the point where a worker can live close enough to make the job in the high cost town worth the commute.
Anyone wanting to do short term rentals all year must abide by the same regulations that traditional accommodation providers do - paying commercial rates, not running their business in a strictly residential area, etc.
I think segmenting the space, as mentioned by matsemann, is a good solution here. If you allocate half the town (including half the areas for future development) to long-term housing and the other to short-term stays, you prevent the markets from sharing a single supply. In the first years it will still be much more profitable to invest and build in the short-term half of town, but as long as there's profit to be made in building in either half of town this will sort itself out.
If the concern is truly that the usage is overall extremely low (not just vacation vs resident), due to property value speculation...there is the idea that property taxes should be higher.[1] This will force productive use of the land.
However, raising property taxes tends to hurt residents more. So...it depends what objective you actually want to achieve.
https://www.youtube.com/watch?v=pRE23YfSvc8
A bit extreme/coarse, but I can't imagine that it wouldn't be effective.