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.