Marc Wilmots' Ivory Coast needed a win at home to qualify for their fourth consecutive World Cup, but two errors by goalkeeper Sylvain Gbohouo put chances of victory out of reach in the first half.
Dirar's in-swinging cross beat everyone and found the corner of the net in the 25th minute.
Immediately after Morocco's national team secured it qualification to the 2018 World Cup in Russia, Moroccans of NY flocked to Steinway street in Astoria to celebrate this victory.
But it proved to be enough and, after missing out in 2010 and 2014, Tunisia will be at the World Cup for a fifth time.
Tunisia's absence has not been as long but they will celebrate a first appearance in 12 years thanks to a goalless draw at home to Libya.
Martellus Bennett is Back with the New England Patriots
He made news during Green Bay's bye week when he announced he was planning to retire at the end of the 2017 season. Bennett thrived in New England last season, catching 55 passes for 701 yards and a career-high seven touchdowns.
It is the fifth time that the Moroccan national football team gets qualified for the global FIFA competition.
Tunisia, on the other hand, will be making a return to the World Cup since Germany 2006 after topping Group A on 14 points, just one point ahead of second-placed Congo Democratic Republic who defeated Guinea 3-1.
Ousmane Sidibe's own goal set DR Congo on their way against Guinea but they were pegged back by Keita Karamokoba's equaliser.
Morocco and Tunisia will join Nigeria, Egypt and Senegal as the African sides in Russian Federation next summer.
DR Congo, meanwhile, had needed Libya to pull off a shock win to give them hope of making it to Russian Federation, but were left disappointed despite a 3-1 win over Guinea in Kinshasa, scoring twice in stoppage time.