The St Andrews Botanic Garden sits at the southern edge of town, about fifteen minutes' walk from the town centre, and is considerably more worthwhile than its modest profile would suggest. The garden covers around 18 acres and has been managed by the university (and latterly by a charitable trust) since 1889. It is used for teaching and research but is open to the public.
The collection is arranged by habitat and geography rather than by species type, which makes it more instructive than many botanical gardens. The rock garden is particularly good, with a wide range of alpine plants laid out on a naturalistic slope. The glasshouses contain a decent tropical collection — a useful refuge in the colder months — and the herbaceous borders in late summer are one of the better displays of their kind in Fife.
Entry is around £5 for adults; free for children under 16. The café is simple but does good coffee and home baking. It is a sensible escape from the golf-and-ruins circuit that defines most visits to the town, and a good option if you have a second day.