Early spring is a good call: most of Thailand is in its dry season, but it heats up fast, so the order you do things in matters.
February / March averages:
Chiang Mai: 34°C / 37°C by day, rain on about 1 day in 20 or less, 9 to 10 hours of sun. Best early on, before it gets properly hot.
Bangkok: 34°C / 35°C, rain on about 1 day in 17 in February, 1 in 12 in March.
Phuket and Krabi: 34 to 35°C, sea 29 to 30°C. Rain on about 1 day in 12 to 17 in February, rising to about 1 in 5 to 7 by March.
Koh Samui: 30 to 31°C, sea 28 to 29°C, rain on about 1 day in 7 both months.
Hua Hin: the driest beach option, rain on about 1 day in 33 in February.
So with three weeks I'd do the north first while it's coolest, then Bangkok, and finish on the beach. If you end up going late March into April, the Andaman side (Phuket, Krabi) gets noticeably wetter, about 1 day in 3 by April, while Hua Hin and Samui hold up better.
(Figures from howhot)