Map from Google - Ko_Samui

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, in which, however, some showers can sometimes occur.
Rainfall amounts to about 1,900 millimetres (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 brief, 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.
Average precipitation - Ko Samui
Ko SamuiJanFebMarAprMayJunJulAugSepOctNovDecYear
Ko SamuiJFMAMJJASONDY
Prec. (mm)1254055851701201451351402754651901945
Prec. (in)4.91.62.23.36.74.75.75.35.510.818.37.576.6
Days94481716161618202015163

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.
Average temperatures - Ko Samui
Ko SamuiJanFebMarAprMayJunJulAugSepOctNovDec
Ko SamuiJFMAMJJASOND
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.

Koh Samui, as other parts of Thailand, can be affected by tropical cyclones, from May to November, although the Gulf of Thailand is a relatively sheltered area, lying halfway between the Bay of Bengal, where cyclones are formed, and the South China Sea, where typhoons arrive from the east.

Koh Samui, sea

For swimming, the sea is warm all year round, as you can see in the following table.
Sea temperature - Ko Samui
Ko SamuiJanFebMarAprMayJunJulAugSepOctNovDec
Ko SamuiJFMAMJJASOND
Sea (°C)282829303030292929292928
Sea (°F)828284868686848484848482

When to go

The best time to visit Koh Samui goes from mid or late January to April, with a preference for February, because it is a bit cooler than March and April.
In the summer, in July and August, it may very well not rain for a week, while at other times it can rain quite often, albeit in the form of showers, which then give way to the sun; however, the heat is muggy, the sun beats down and there is a risk, albeit not high, of tropical cyclones. The worst time is that of the retreating monsoon, especially the month of November.