Abdullah bin Amr bin As reported,

I heard the Messenger of Allah ﷺ say, "Allah does not take away knowledge by snatching it from people, but He takes knowledge away by taking the scholars, until, when no scholar remains, people take ignorant ones as their leaders. They are then asked questions, and they give rulings without knowledge, so they go astray and lead others astray."Al-Farabri said, Abbas narrated to us, saying, Qutayba narrated to us, Jareer narrated to us from Hisham something similar.

Bukhari 100

Sahih

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

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

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

البخاري 100صحيح
Contents
Reference
Commentary
Ayat
Collection
Sahih Bukhari
Book
Knowledge
Chapter
How knowledge will be taken away
Numbering
Darussalam 100
Bukhari 100