There are rarely any direct flights to Fez so you'll have have to connect from Casablanca to Fez.
You can connect using 3 ways from Casablanca
Flights are a totally uncalled for expense. One hour direct flights from Fez to Casablanca cost a minimum of $150. ( approximately 1400 dirhams).
Shared taxis (grand taxis) cost 1300 dirhams to be shared amongst 4 people, everyone pays about 325 dirhams.
What I liked about shared taxis is that they are readily available outside Casablanca airport, at level 0 outside the arrivals area and operate 24/7.
Shared taxis are best for budget travelers with lots of luggage.
Duration of travel when using taxis: 4 hours
I took the train once from Casablanca, airport. Once you buy the train tickets at the airport (you don't have to book online) they put you on a connecting train from the airport to Casablanca voyager train station where you'll take the train to Fez. Took a total of 5 hours to get to Fez, 40 minutes from the airport to the train station and 4 hours to Fez.
There's a train from the airport to the train station every hour. You'll arrive at the train station just in time for the Fez train.
Train cost: 200 dirhams per person for a first-class ticket.