Note that numbers are a poor reference for ahadith as they differ with the publication. Also it is difficult to find something in the Musnad from translation of the content alone.
Possibly you are referring to this hadith:
عن معاذ قال: عهد إلينا رسول الله صلى الله عليه وسلم في خمس من فعل منهن كان ضامنا على الله: من عاد مريضا، أو خرج مع جنازة، أو خرج غازيا في سبيل الله، أو دخل على إمام يريد بذلك تعزيره وتوقيره، أو قعد في بيته فيسلم الناس منه ويسلم
[ My own translation so treat with caution]
Muadh ibn Jabal narrrated: The Messenger of Allah ﷺ promised us regarding five acts that the one does does them Allah will be his guarantor:
- One who visits the sick
- One who goes out with the funeral
- One who takes part in battle in the way of Allah
- One who visits the Imam to respect and esteem him
- One who sits at his home so that the people remain safe from him and he remains safe from them
— Musnad Ahmad - تمة مسند الأنصار حديث معاذ بن جبل
As goldPseudo has mentioned, there are variants of this hadith recorded by Ibn Hibban, Ibn Khuzaima, Tabarani, Hakim etc. Also there are several other ahadith with similar meaning, for example:
قلت: يا رسول الله، ما النجاة؟. قال: أمسك عليك لسانك، وليسعك بيتك، وابك على خطيئتك
I asked the Messenger of Allah (ﷺ), "How can salvation be achieved?"
He replied, "Control your tongue, keep to your house, and weep over your sins."
— Jami at-Tirmidhi ~ Saheeh al-Albani
The context of these is living in solitude (العزلة) in general so as to avoid sins and fitnah, and they are not about epidemics. On the other hand there are ahadith about general quarantine during epidemics such as this one.