It is walking distance from the Railway Station, but if you want to go to St Andrews (as it seems from previous posts), you can't do it by train.
You can get a bus from the station however, and a taxi is about £20 from Leuchars to St A's.
I've never flown into it (but will do eventually), but my Mother-In-Law lives just off base if you need any more info.