Train details can be found at, the nearest station is Leuchars
Bus information can be found at
The nearest airport is Edinburgh, an hours drive from St. Andrews.
Best way to get to St. Andrews without a car would be to take 747 airport bus link to Halbeith Park and Ride near Dunfermline then catch the bus (X24 or X59) into St Andrews