السلام عليكم ورحمة الله وبركاته
Brother, the complete hadith you are referring to is:
It was narrated from ‘Uqbah ibn ‘Aamir al-Juhani that a group came to the Messenger of Allaah (ﷺ) [to swear their allegiance (bay’ah) to him]. He accepted the bay’ah of nine of them but not of one of them. They said, “O Messenger of Allaah, you accepted the bay’ah of nine but not of this one.” He said, “He is wearing an amulet.” The man put his hand (in his shirt) and took it off, then he (ﷺ) accepted his bay’ah. He ﷺ said, ‘Whoever wears an amulet has committed shirk.”
References;
Musnad Ahmad (Volume: 28 / Pg. 637, Risalah Edition) Hadith No. 17423
Mustardak al-Hakim, Hadith Number: 7513
••••••
It has been classified as Sahīh by al-Albānī in:
Ṣaḥīḥ Targeeb Wat Tarheeb, No. 3455
Silsillah As-Saheeha, No. 492
Ṣaḥīḥ al-Jāmī', Hadeeth Number: 6394
Ghayatul Maram Takhreej (No. 294)