Peaceable Projects Inc. is a U.S.-based non-profit group that brings the vast resources of the wide world together with the ongoing needs of the people who live, work, and travel on the Camino de Santiago pilgrim trail network in Spain.
I don't know if they go to Sarria but they do run routes round various parts of Galicia and have buses that reach down to Madrid. Having said that, there seems to be a problem booking online with a non-Spanish bank card.
If you look at the RENFE site http://horarios.renfe.es/hir/ingles.html
and select Madrid as your start and Lugo as your destination it seems to show Sarria on the route as the last station before Lugo. (click on Atlantico under Type of Train)
Worst case go on to Lugo and get the local train back.
PS I stayed by the station one year and there were plenty of trains going through.