Generally speaking, the laws of the country whose flag a ship is flying will apply to that ship and its crew while they are in international waters. However, there are also a number of international laws and treaties that apply to all ships, regardless of their flag or nationality. These laws cover a variety of topics, including safety, pollution, and navigation.
In some cases, countries may also have special laws that apply to their own citizens or vessels in international waters. For example, the United States has laws that prohibit US citizens from engaging in certain activities, such as piracy or drug smuggling, in international waters.
It is important to note that the laws that apply in international waters can be complex and may change over time. If you are planning to travel in international waters, it is important to consult with an attorney or other expert who can advise you on the specific laws that may apply to your situation.