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 are sometimes possible. Rainfall amounts to about 2,000 millimetres (79 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 comes the true monsoonal peak, when the rains are torrential, especially in November. In this period of the year-end, the northeast monsoon, or retreating monsoon, starts to blow, affecting the coasts exposed to winds coming from the sea, like this island which is located at a short distance from the Peninsular Thailand.
Here is the average precipitation.
Average precipitation - Ko Samui
Ko SamuiJanFebMarAprMayJunJulAugSepOctNovDecYear
Prec. (mm)1254055851701201451351402754651901945

As for the temperatures, as mentioned they are 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 temperatures is observed, although less marked than in the mainland of Thailand; April and May are, albeit slightly, the warmest months. Then in the summer months the heat continues to be intense and sultry, though tempered, as happens in the rest of the year, by sea breezes.
Here are the average temperatures.
Average temperatures - Ko Samui
Ko SamuiJanFebMarAprMayJunJulAugSepOctNovDec
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, may 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
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. The heat is still 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.