Only as a Thai citizen or with a Thai registered compan.
As a non-Thai national you are not allowed to buy/own land in Thailand. If you are told otherwise, it is not true.
As a non Thai national you can rent (lease) land for a maximum of 30 years. Yes, you can include a clause in the lease agreement that gives you an additional 30 year extension after the first 30 years. However, this clause is not binding and can be removed to your disadvantage. For example, if your landlord sells his property. The new owner will not be bound by this clause.
When you lease land, that land is legally yours. You are entered in the so-called Chanote (comparable to the German land register) and you do what you want (within the framework of the laws and local building regulations).
30 years is a long time. A lot can change. Perhaps also the attitude of the Thai government in this regard. Tourism is a very important economic factor in this country.
But nobody will be able to tell you exactly what will happen after 30 years. So assume that after 30 years the land (and the building(s) on it) will be returned to the landlord. Don't believe anyone who says otherwise.
You can start a Thai company. Legally you own 49% of it. You need two (or more) Thai partner(s) who own 51% . With this company you can buy land (in the name of the company). 49% of it belongs to you and on paper the 51% Thai decide what happens.
Be aware that with a Thai company the Thai finance adminstration at some stage will require your company to make revenue. So be prepared that you might need to subrent (or other activities) to justify the existance of the company.