No, the Nile River does not run through Morocco or Western Sahara.
The Nile flows through northeastern Africa only. Its course:
Morocco and Western Sahara are in northwestern Africa**, thousands of kilometers west of the Nile Basin. Their drainage is to the Atlantic (Morocco: Sebou, Moulouya, Oum Er-Rbia; Western Sahara: intermittent wadis).
The confusion may arise from "North Africa" as a broad region, but hydrologically, the Nile and Maghreb basins are entirely separate.