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
By train
By taxi
By flight
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.
From the train station, petit taxis will charge about 10 dirhams to Fez el Bali Medina.
Finding a metered taxi at the station was quite difficult for me, on inquiry taxi drivers were charging me 50 dirhams and did not want to use taxis so I had to walk a bit from the station.
From the airport, taxis cost about 150 Dirhams so the best option is to take the bus.
Take bus number 16 from the airport, it will drop you off at a place at a stop where you'll pick bus number 19 that will take you to the medina.
How to get around Fez Medina.
Don't go to the medina blindly you'll get lost. If you stay at a riad ask for a guide.