Its an hour and 20 in the car quite easily, there is no major motorway there, no train station, and the public transport would take considerably longer and is erratic at best. You'd spent £250 a month on transport, quite easily.
Commuting from Glasgow to Edinburgh is doable, I know a few people who live in one city and go to university in the other, since there is regular trains which take around 50 minutes- but St Andrews is next to impossible without at least moving to Edinburgh.