Abdullah bin Amr bin As reported,

The Messenger of Allah ﷺ said, "Allah does not take away knowledge by snatching it from people, but rather He takes away knowledge by taking the scholars, until, when no scholar remains, people take ignorant ones as their leaders. They are asked questions and give rulings without knowledge, so they go astray and lead others astray."

Tirmidhi 2652

Sahih

حدثنا هارون بن إسحق الهمداني حدثنا عبدة بن سليمان عن هشام بن عروة عن أبيه

عن عبد الله بن عمرو بن العاص قال

قال رسول الله ﷺ إن الله لا يقبض العلم انتزاعا ينتزعه من الناس ولكن يقبض العلم بقبض العلماء حتى إذا لم يترك عالما اتخذ الناس رءوسا جهالا فسئلوا فأفتوا بغير علم فضلوا وأضلوا

الترمذي 2652صحيح
Contents
Reference
Commentary
Ayat
Collection
Jami Tirmidhi
Book
Knowledge
Chapter
Disappearance of knowledge
Numbering
Darussalam 2652
Tirmidhi 2652