You cant just tell a population to reject a way of thinking but apparently someone did manage to do that
In my country science almost ceased to exist after the fall of Soviet Union. So economic conditions do play a role. The western Age of Reason in XVIII also has relationship to complex changes in the society - rise of merchant class, acceptance of usury, etc. And I would say that "whole population avoids science like a plague" would be a strong overstatement more echoing the modern view on Islamic countries with strong Salafi influence.
Come on... are you for real? You're telling me that subsistence farmers should have the same "thirst for knowledge" as scholars in a rich economic and cultural centre of an empire? Of course economic conditions matter! Some people are even of the opinion that they're the only things that matter.
The factors were complex. There were economic and socio-political events that affected the stability and life in these societies. Several other reasons contributed to this downfall and it finally happened. To pin all the blame on a single scholar is disingenuous. Al Ghazzali's "Incoherence of the philosophers" was a warning against some of the techniques philosophers used especially in the context of interpreting the primary texts of Islam to come up with religious rulings. There were also philosophical arguments against scientific (read material) explanations precluding the hand of God in material affairs but this wasn't one killing blow against centuries of scientific scholarship.
Here are a few articles that discuss this from a traditional Muslim point of view if you're interested. https://mohamedghilan.wordpress.com/2013/12/22/an-illusion-o... https://traversingtradition.com/2020/11/19/science-history-a.... I had something that addressed it more directly but can't find it right now.