Koh Samui, where it is

In Ko Samui, the climate is tropical, hot all year round, with a long rainy season due to the monsoon of Southeast Asia, which runs from May to mid-January, and a drier season, from mid-January to April. The driest months are February and March, when, however, some showers can sometimes occur.
Rainfall amounts to about 1,900 millimeters (77 inches) per year, and the brevity of the dry season allows the forest to grow in the interior of the island. Within the rainy season we can distinguish between two periods: at the beginning, in May, there's a first peak, then the rains are quite abundant but without excesses from June to September, when they occur in the form of showers or downpours, usually short-lived, and finally, between October and December the true monsoonal peak occurs, when the rains are torrential, especially in November. This happens because in the last months of the year the northeast monsoon, or retreating monsoon, starts to blow, affecting the coasts exposed to the wind coming from the sea, such as this island which is located a short distance from the Peninsular Thailand.
Here is the average precipitation.
Ko Samui - Average precipitation

As mentioned, the temperature is high throughout the year, around 24/25 °C (75/77 °F) at night and 30 °C (86 °F) during the day, however, the coolest months are December and January, while from February to May a rise in temperature is observed, though less marked than in the mainland of Thailand; April and May are, albeit slightly, the hottest months. In the summer months, the heat continues to be intense and sultry, though tempered by sea breezes, as happens in the rest of the year.
Here are the average temperatures.
Ko Samui - Average temperatures
Min (°C)242526262626252525242424
Max (°C)293031323332323232313029
Min (°F)757779797979777777757575
Max (°F)848688909190909090888684

The amount of sunshine is good in the driest period, from mid-January to April, while in the rest of the year the sun often shines, but it alternates with some cloudiness, more or less widespread, and associated with rain showers.
Ko Samui - Sunshine

Koh Samui, as other parts of Thailand, can be affected by tropical cyclones, in particular typhoons coming from the east, which in recent decades have entered the Gulf of Thailand only from mid-October to about 20 December, although being the sea always warm, it can not be excluded that they can also be formed in other periods. Anyway, the Gulf of Thailand is a relatively sheltered area, since it lies halfway between the Bay of Bengal, where cyclones are formed, and the South China Sea, where typhoons arrive from the east, and normally pass to the north, directly affecting the continental part of Thailand.

Koh Samui, sea

The sea in Ko Samui is warm enough to swim in all year round, as you can see in the following table.
Ko Samui - Sea temperature
Temp (°C)282829303030292929292928
Temp (°F)828284868686848484848482

Best Time

The best time to visit Koh Samui is from the middle or the end of January through April, with a preference for February because it is a bit cooler than March and April.
In the summer, in July and August, it might very well not rain for a week, while at other times it may rain quite often, albeit in the form of showers, which then give way to the sun. However, the heat is muggy. The worst time is that of the retreating monsoon, especially the month of November.