While I generally agree with
@metalinvader665 (up to a point, that said : Tunisia and Algeria remained exporters of grain until the Late Middle-Ages and still so under some periods until the XIXth) , it's worth remembering that Africa being treated as a gigantic farmed land is mostly a Roman things. Carthage was of course supported by a large agricultural production, but safe trade goods as wine, wool, horse, and olives (whom a significant part came from Numidia), grain doesn't seems to have been a main export to the Mediterranean basin, except what was sent (admittedly a significant part until the IVth) to Phoenician cities.
The use of North Africa as the breadbasket of Rome depended a lot from Roman predominance and rule : it held for a time in the late Vth century, but with the generalized revolt of Berbers against Vandals, and their incapacity (then Romans) to really dominate much of the hinterland, it reverted to being "just" particularly productive.
On the other hand, it's hard to really assess the consequences of the Hillalian invasion long-term : it was probably destructive for the hinterland, but what's more important long-term was the inability of Ifriqiyan polities to recover from it and from Italian particularily active (and aggressive) concurrence.
Eventually, more the region shattered and lost political unification, less productive agriculturally it was (in no small part because f the need of irrigation features in the hinterland), and more unified, more productive. Since the Fatimid takeover of Ifriqiya and until the Hafsids, it was hard on this regard.
Again, it's to be noted that Hafsids exported grain to Near East, so it must be nuanced.
In addition to what was said, there's the agricultural-related technology gap compared to other parts of the Mediterranean basin, such as the lack of wheelbarrow, at least as we understand it (there was the use of a barrow led by a sheep).