As I understand it "Libya" supplied a lot of grain to Rome and presumably supported Carthage at its zenith. Did the region grow less fertile until the present day, or is it a matter of relative fertility?
The Maghreb was and always has been very fertile.
To quote from UNESCO’s General History of Africa, vol. III:
“The coastal belt possesses ample resources and vegetation. The northern slopes of the Atlas mountains afford excellent wooded pastureland and produce fine olive trees. In the north the coast and the mountain-sides enjoy all the mildness of the Mediterranean climate, referred to by Ibn Khaldun as mizadj al-tulul. “
Morocco & Algeria each have more arable land than Italy (78,155 & 73,833 sq/km, respectively, to Italy’s 68,697), only France and Turkey had more cultivated land. This is why it was referred to as the bread basket of the Roman Empire (https://wikivisually.com/wiki/Arable_land)
Talking about the modern day, Morocco is still a very fertile land. If you go to any supermarket in the UK for example , a large quantity of the fruits are imported from Morocco.
Coming on to modern day Algeria. The Algerian governments obsession with oil has rendered the agricultural industry irrelevant. During the French occupation of Algeria, Algeria was a net exporter of products such as wheat and wine.
Specifically looking at wine, just before Algeria declared independence from France, Algerian wine (along with the production of Morocco and Tunisia) accounted for nearly two-thirds of the total international wine trade. ( Jancis Robinson “Algeria". Oxford Companion to Wine p11.)
In short the Maghreb in particular Algeria and Morocco have always been a fertile land. Modern day however a variety of reasons have caused a decrease in agricultural production.