Best to buy tickets when there, however, I did just google this link, "http://www.eastafricashuttles.com/train.htm".

Please note that I know NOTHING about this organisation - but in case it helps...

If you are staying at a hotel the concierge can arrange it for you, otherwise there are tens of travel agencies in town (Kenyatta Avenue boasts a few) which will be able to book them for you.