I think it will be helpful if you narrow your question down a little. The variables are so many and all have an impact on the cost. Just to name a few: location, size, projected membership, facilities offered (eg. swimming pool etc.).
It can cost as much as you’re willing to spend.
I would start with a business plan and an outline of everything you want to offer
From there I would look at spaces that will accommodate your list
Once you know what the structure will cost you can them calculate upgrades, construction, and all other additions.
From there, I would get a calculation of equipment , flooring, mirrors, etc along with staff facilities and employee/independent contractor expenses.
Make sure you have a business lawyer, an accountant, liability insurance, and are in compliance with your town and all business codes.
Or, purchase an existing gym
I agree with the others. Some of the factors you need to consider when building a gym are the size, the location, your available budget, the type of clients you are targeting, the type of training you will be doing, the type of equipment you are looking to get and also your business plan. Sometimes the contractors you will be using to build your gym can influence your overall costs.