Traced to Ka'b al-Ahbar (automatic guess): a report of earlier scriptures, not a hadith of the Prophet ﷺ.
من صبر على فتنة الدجال لم يفتتن ولم يفتن أبدا حيا ولا ميتا، ومن أدركه ولم يتبعه وجبت له الجنة، وإذا أخلص الرجل وكذب الدجال مرة واحدة، قال: قد علمت من أنت: أنت الدجال، ثم قرأ فاتحة سورة الكهف، ولم يستطع أن يفتنه، وكانت له تلك الآية كالتميمة من الدجال، فطوبى لمن نجا بإيمانه قبل فتن الدجال وهوانه وصغاره، وليدركن الدجال أقواما مثل خيار أصحاب محمد صلى الله عليه وسلم
Whoever is patient with the temptation of the Dajjal will not be tempted and will never be tempted, alive or dead, and whoever catches him and does not follow him is guaranteed Paradise. And if the man is sincere and the Dajjal lies once, he says: I know who you are: you are the Dajjal. Then he recites the opening of Surat Al-Kahf, but he was unable to be tempted, and that verse was like an amulet from the Dajjal. So blessed is he who is saved by his faith before the temptations of the Dajjal, his humiliation and his youth, and let the Dajjal overtake people like cucumbers. Companions of Muhammad, ﷺ
بقية وأبو المغيرةصفوبن عمروشريح بن عبيدكعبautomatic reading, unverified