"إِنْ كُنْتَ لابُدَّ سَائِلًا فَاسْأَلِ الصَّالِحينَ".
See similar narrations below:
Collected by Nasāʾī, Abū Dāwūd, Aḥmad, Ṭabarānī, Nasāʾī's Kubrá, Suyūṭī"Shall I ask people (for help), O Messenger of Allah?" He said: "No, but if you have no alternative but to ask, then ask the righteous."
لِرَسُولِ اللَّهِ ﷺ أَسْأَلُ يَا رَسُولَ اللَّهِ قَالَ لاَ وَإِنْ كُنْتَ سَائِلاً لاَ بُدَّ فَاسْأَلِ الصَّالِحِينَ
Al-Firasi asked the Messenger of Allah ﷺ: May I beg, Messenger of Allah? The Prophet ﷺ said: No, but if there is no escape from it, beg from the upright.
لِرَسُولِ اللَّهِ ﷺ أَسْأَلُ يَا رَسُولَ اللَّهِ فَقَالَ النَّبِيُّ ﷺ لاَ وَإِنْ كُنْتَ سَائِلاً لاَ بُدَّ فَاسْأَلِ الصَّالِحِينَ
Al-Firasi asked the Messenger of Allah ﷺ: May I beg, Messenger of Allah? The Prophet ﷺ said: No, but if there is no escape from it, beg from the upright. (Using translation from Abū Dāʾūd 1646)
لِرَسُولِ اللهِ ﷺ أَسْأَلُ؟ قَالَ النَّبِيُّ ﷺ لَا وَإِنْ كُنْتَ سَائِلًا لَا بُدَّ فَاسْأَلِ الصَّالِحِينَ
[Machine] That his father Al-Firasy came to the Prophet ﷺ and said, "O Messenger of Allah, I have a question?" He said, "No, indeed, if you must ask, then ask the righteous ones."
أَنَّ أَبَاهُ الْفِرَاسِيَّ أَتَى النَّبِيَّ ﷺ فَقَالَ يَا رَسُولَ اللهِ أَسْأَلُ؟ قَالَ «لَا وَإِنْ كُنْتَ لَا بُدَّ سَائِلًا فَسَلِ الصَّالِحِينَ»
"Shall I ask people (for help), O Messenger of Allah?" He said: "No, but if you have no alternative but to ask, then ask the righteous." (Using translation from Nasāʾī 2587)
لِرَسُولِ اللهِ ﷺ أَنَسْأَلُ يَا رَسُولَ اللهِ؟ قَالَ «لَا وَإِنْ كُنْتَ سَائِلًا وَلَا بُدَّ فَاسْأَلِ الصَّالِحِينَ»
"لَا، وَإنْ كنْتَ لَابُدَّ سَائِلًا فَاسْأل الصَّالحِينَ".