Yes, foreigners are allowed to work in Thailand if you have a valid visa, a work permit and is employed with an occupation that does not violate the Alien Employment Act.
If you are a foreigner and you intend to work in Thailand, you are subject to the Alien Employment Act, which requires you to have a work permit to be issued by the Department of Employment, Ministry of Labor, or unless it falls within an exception of the said Act.
The term “work” in Thai law is defined very broadly, covering both physical and mental activities, whether or not for wages or other form of compensation. Even volunteer or charity work requires a work permit in Thailand.
According to Thai law, foreigners can work in the country butfactors such as the national security, as well as the need of alien labor for the development of the country is being considered. Thai nationals are still to be given priority.