Agafay vs Merzouga and the Sahara
Merzouga has the tall orange dunes; the Agafay does not. Merzouga is also around nine hours of driving each way, which realistically means three days. The Agafay is under an hour away and gives you desert space, silence and a night under the stars without the road.
If you have a week and the dunes are the reason you came to Morocco, go to Merzouga. If you have three or four days in Marrakech, the Agafay is the sensible desert.
Agafay vs the Ourika Valley
Ourika is the opposite landscape: a green river valley in the Atlas foothills with waterfalls, terraces and shade, around an hour from the city. Go there for water and mountains, and to the Agafay for open desert, activities and desert camps.
They pair well. A single day can take in the plateau in the morning and the valleys in the afternoon.
Which to pick for a short trip
Two or three days in Marrakech: Agafay. Four or five and you want variety: Agafay plus Atlas. A week with the dunes as a priority: Merzouga, and keep the Agafay for the evening you get back.