The journey from Saint Andrews to GLA Airport will take you aproximately 3hours. (*Subject to time of travel and date) This will most likely be Bus - Train - Train - Bus.
Head to St Andrews busstation, from there you take the bus Leuchars Railway station (Platform 2) and board the train to Dundee Railway station. From Dundee Railway station head to Glasgow Queen Street where you can take the 500 Airport Express bus towards Glasgow Airport