ONCF runs a comfortable, genuinely reliable rail network, and Fes to Marrakech takes roughly seven hours with a change at Casablanca. First class is air-conditioned, reserved, and inexpensive. Morocco's high-speed line, Al Boraq, runs Tangier to Casablanca and does not serve this leg, so do not expect those speeds.
The train is a good option if you are travelling independently between the two cities and do not want a driver. Its limitation on a private tour is that it only connects the two endpoints — you cannot stop at Ait Ben Haddou, the gorges or the dunes, because none of them are on a railway. Check current schedules close to travel; timetables change seasonally.