Caution: Translations of Quran and Ḥadīth may lead to possible misapplications and misinterpretations. This site is intended for students of sacred knowledge that are proficient in comprehending classical Arabic and have a strong foundation in Islamic sciences. Also note that religious injunctions rely on several aspects beyond what one may glean through reading individual aḥādīth.
quran:68:7

Indeed, your Lord is most knowing of who has gone astray from His way, and He is most knowing of the ˹rightly˺ guided.  

Assuredly your Lord knows best those who stray from His way, and He knows best those who are guided, to Him.
القرآن:٦٨:٧

إِنَّ رَبَّكَ هُوَ أَعْلَمُ بِمَنْ ضَلَّ عَنْ سَبِيلِهِ وَهُوَ أَعْلَمُ بِالْمُهْتَدِينَ  

{إن ربك هو أعلم بمن ضل عن سبيله وهو أعلم بالمهتدين} له وأعلم بمعنى عالم.

See similar narrations below:

Collected by Qurʾān
quran:6:117

Indeed, your Lord is most knowing of who strays from His way, and He is most knowing of the ˹rightly˺ guided.  

Your Lord knows best those who stray from His way and He knows well the rightly guided, and will requite both of them.
القرآن:٦:١١٧

إِنَّ رَبَّكَ هُوَ أَعْلَمُ مَنْ يَضِلُّ عَنْ سَبِيلِهِ ۖ وَهُوَ أَعْلَمُ بِالْمُهْتَدِينَ  

{إن ربَّك هو أعلم} أي عالم {من يَضل عن سبيله وهو أعلم بالمهتدين} فيجازي كلا منهم.
quran:16:125

Invite to the way of your Lord with wisdom and good instruction, and argue with them in a way that is best. Indeed, your Lord is most knowing of who has strayed from His way, and He is most knowing of who is ˹rightly˺ guided.  

Call, mankind, O Muhammad (s), to the way of your Lord, ˹to˺ His religion, with wisdom, ˹with˺ the Qur’ān, and fair exhortation, its ˹the Qur’ān’s˺ fair exhortations, or with gentle words, and dispute with them by way of that which, that is, by way of that ˹manner of˺ disputation which, is best, such as calling ˹them˺ to God by way of His signs and calling ˹them˺ to His definitive arguments. Truly your Lord knows best, that is, He is fully knowledgeable ˹of˺, those who stray from His way and He knows best those who are guided, and will requite them — this was ˹revealed˺ before the command to fight ˹them˺.
القرآن:١٦:١٢٥

ادْعُ إِلَىٰ سَبِيلِ رَبِّكَ بِالْحِكْمَةِ وَالْمَوْعِظَةِ الْحَسَنَةِ ۖ وَجَادِلْهُمْ بِالَّتِي هِيَ أَحْسَنُ ۚ إِنَّ رَبَّكَ هُوَ أَعْلَمُ بِمَنْ ضَلَّ عَنْ سَبِيلِهِ ۖ وَهُوَ أَعْلَمُ بِالْمُهْتَدِينَ  

{ادع} الناس يا محمد {إلى سبيل ربك} دينه {بالحكمة} بالقرآن {والموعظة الحسنة} مواعظه أو القول الرقيق {وجادلهم بالتي} أي بالمجادلة التي {هي أحسن} كالدعاء إلى الله بآياته والدعاء إلى حججه {إن ربك هو أعلم} أي عالم {بمن ضل عن سبيله وهو أعلم بالمهتدين} فيجازيهم وهذا قبل الأمر بالقتال ونزل لما قتل حمزة ومثِّل به فقال ﷺ وقد رآه: لأمثلن بسبعين منهم مكانك.
quran:53:30

That is their sum of knowledge. Indeed, your Lord is most knowing of who strays from His way, and He is most knowing of who is guided.  

That, namely, the desire of this world, is the full extent of their knowledge, that is, the limit of their knowledge, namely, that they have preferred this life to ˹that of˺ the Hereafter. Truly your Lord knows best those who have strayed from His way, and He knows best those who are ˹rightly˺ guided: He has knowledge of both and will requite both.
القرآن:٥٣:٣٠

ذَٰلِكَ مَبْلَغُهُمْ مِنَ الْعِلْمِ ۚ إِنَّ رَبَّكَ هُوَ أَعْلَمُ بِمَنْ ضَلَّ عَنْ سَبِيلِهِ وَهُوَ أَعْلَمُ بِمَنِ اهْتَدَىٰ  

{ذلك} أي طلب الدنيا {مبلغهم من العلم} أي نهاية علمهم أن آثروا الدنيا على الآخرة {إن ربك هو أعلم بمن ضل عن سبيله وهو أعلم بمن اهتدى} عالم بهما فيجازيهما.