Is this statement that is attributed to ‘Ali (may Allah be pleased with him) sound – “Did you come to know your Lord through Muhammad?”?
Question

How sound is the hadith: ‘Ali ibn Abi Taalib asked: Did you come to know your Lord through Muhammad or did you come to know Muhammad through your Lord…? to the end of the hadith.
Praise be to Allah.1. Comment on the soundness of the statement attributed to ‘Ali (may Allah be pleased with him)
Ibn al-Jawzi (may Allah have mercy on him) stated that this statement is falsely attributed to ‘Ali (may Allah be pleased with him), as he quoted its isnaad:
It was narrated that Muhammad ibn Ashras as-Sulami said: Muhammad ibn Sa‘eed al-Harawi said: Ismaa‘eel ibn Yahya ibn ‘Ubaydillah at-Taymi and ‘Ali ibn Ibraaheem al-Haashimi informed us, from Yahya ibn ‘Aqeel al-Khuzaa‘i, from his father, from ‘Ali ibn Abi Taalib, that a man asked him: Did you come to know Allah through Muhammad or did you come to know Muhammad through Allah?
He said: If I came to know Allah through Muhammad, Muhammad would be more credible than Allah, and if I came to know Muhammad through Allah, I would have no need of the Messenger of Allah. Rather Allah (may He be exalted) caused me to know him, without describing how, as He willed. He sent Muhammad as a Messenger to convey the Qur’an and faith, and He established proof so that people would adhere to the path of Islam. So I believed what he brought from Allah, because he did not bring anything contrary to the command of his Lord, for none of the messengers before him did anything contrary [to the command of their Lord]. He brought guidance and glad tidings, and taught us to believe in the messengers who came before him. Ibn al-Jawzi said: This is a fabricated hadith that is falsely attributed to ‘Ali (may Allah be pleased with him), because he is too good to say such a thing. The one who is accused of fabricating it is Muhammad ibn Sa‘eed, who narrated it from Ismaa‘eel. Ibn ‘Adiyy said: Ismaa‘eel narrates false reports from trustworthy narrators. As for al-Haashimi, he is unknown.
End quote from al-‘Ilal al-Mutanaahiyah fi’l-Ahaadeeth al-Waahiyah (2/942).
Adh-Dhahabi (may Allah have mercy on him) said:
May Allah curse the one who fabricated it, namely Muhammad ibn Ashras as-Sulami – a liar – who narrated it from Muhammad ibn Sa‘eed, from Ismaa‘eel ibn Yahya – who is suspicious.
End quote from Talkhees Kitaab al-‘Ilal al-Mutanaahiyah (p. 370).
Ash-Shawkaani (may Allah have mercy on him) said:
‘Ali (may Allah be pleased with him) said, when it was said to him: Did you come to know Allah through Muhammad (blessings and peace of Allah be upon him), or did you come to know Muhammad through Allah (may He be exalted)?
He said: I did not need the Messenger of Allah, but Allah (may He be exalted) caused me to know him, without describing how, as He willed. He sent Muhammad as a Messenger to convey the Qur’an and faith …
Narrated by al-Jawzaqaani in al-Waahiyat (Flimsy Reports).
Ibn al-Jawzi said: This is a fabricated hadith that is falsely attributed to ‘Ali (may Allah be pleased with him).
End quote from al-Fawaa’id al-Majmoo‘ah (p. 455).
This statement is mentioned in the books of the Shi‘ah as part of a lengthy story. The evidence that it is a lie is very obvious, because in that story they impugn Abu Bakr and ‘Umar (may Allah be pleased with them), and cast aspersions on their knowledge. They narrate this report with an isnaad that is not free of narrators who were accused of lying or are unknown, as in the book of the Shi‘i Ibn Baabawayh al-Qummi which is called at-Tawheed (p. 210) and elsewhere.
2. Comment on the meaning of the statement
Similar phrases are also narrated in some of the books of the scholars which are attributed to some of the early generations, without mentioning any names.
Shaykh al-Islam Ibn Taymiyah (may Allah have mercy on him) said:
‘Abd al-Wahhaab ibn Abi’l-Faraj al-Maqdisi said: That was narrated from a number of our pious predecessors. One of them was asked: Did you come to know Allah through Muhammad or did you come to know Allah through Him? He said: I came to know Allah through Him and I came to know Muhammad through Allah. If I came to know Allah through Muhammad, the source of that favour would have been Muhammad, not Allah.
End quote from Dar’ Ta‘aarud al-‘Aql wa’n-Naql (9/25).
What they meant by that is that the believer comes to know Allah and His Messenger by the help and guidance of Allah, not by merely thinking and reflecting upon what the Messenger (blessings and peace of Allah be upon him) brought, as Allah (may He be exalted) says:
“And know that among you is the Messenger of Allah . If he were to obey you in much of the matter, you would be in difficulty, but Allah has endeared to you the faith and has made it pleasing in your hearts and has made hateful to you disbelief, defiance and disobedience. Those are the [rightly] guided 
 [It is] as bounty from Allah and favor. And Allah is Knowing and Wise”
[al-Hujuraat 49:7-8]
“And if we had willed, We could have given every soul its guidance, but the word from Me will come into effect [that] "I will surely fill Hell with jinn and people all together”
[as-Sajdah 32:13].
At the same time, they do not deny that there are means and measures for this guidance that have been ordained by Allah (may He be exalted), the greatest of which is the call of the Messengers and their teaching the people.
Shaykh al-Islam Ibn Taymiyah (may Allah have mercy on him) said:
Those of Ahl as-Sunnah who argue that knowledge and faith could be attained by virtue of Allah’s blessing, mercy and guidance, and by virtue of His enabling a person to know Him, and other such phrases, their words imply that what the Qadaris say is false.
This is true, but that does not necessarily mean that attaining knowledge cannot happen through reflection and thinking, and it does not mean that knowledge cannot be attained through the teaching of the Messenger, the scholars and the believers, and the supplications and explanation of the evidence that they establish.
Rather it is well known that knowledge could be attained sometimes through what a person hears from people of explanation and teaching, either by way of establishing and showing rational evidence, or by way of telling the true facts.
And sometimes it happens by means of what Allah enables him to understand through thinking and contemplation, and evidence that he is inspired to find, and even sometimes by means of his own efforts and his own reasoning.
And sometimes it happens by means of what Allah compels him to know without any effort on his part…
That is because of what Allah has established in the believers’ hearts of faith, whether it came about because of the individual’s efforts, such as thinking and reasoning, or by other means, or without that. All of these means happened by the will and decree of Allah, and they are part of the blessings that Allah bestows upon His slave, for Allah is the source of blessings by making the means and measures available to the individual.
Whoever thinks that knowledge and faith could be attained by mere contemplation and reasoning – as the Qadaris say – is wrong. This is what these people tried to prove was wrong.
End quote from Dar’ Ta‘aarud al-‘Aql wa’n-Naql (9/28-29).
And Allah knows best.