This isn't terribly easy. It isn't a main town or destination, and there aren't many direct trains. We were coming from Krakow, near where I was working, and we travelled overnight, The journey involved changing trains twice, waiting in Lublin station for an hour at 2am, and getting to Zamosc at 5:30am. From a perusal of the train timetable at the time, the only other options involved antisocially early trains from Krakow, leaving about 5am. Not much of a choice!
Coaches go to Zamosc too, from Warsaw, Lublin and Krakow, and these might prove a better way to get here than the train.