Abu Dharr reported,

I asked the Prophet ﷺ, "Which deed is best?"He replied, "Faith in Allah and struggle in His path."I asked, "And which slave is best to free?"He said, "The one most expensive in price and most prized by their owner."I said, "What if I cannot do that?"He answered, "Then help someone in need, or work on behalf of someone unable to do for himself."I said, "What if I cannot do that either?"He replied, "Then keep your harm away from people, for that is a charity you give to yourself."

Bukhari 2518

Sahih

حدثنا عبيد الله بن موسى عن هشام بن عروة عن أبيه عن أبي مراوح

عن أبي ذر رضي الله عنه قال

سألت النبي ﷺ أي العمل أفضل قال إيمان بالله وجهاد في سبيله قلت فأي الرقاب أفضل قال أعلاها ثمنا وأنفسها عند أهلها قلت فإن لم أفعل قال تعين ضايعا أو تصنع لأخرق قال فإن لم أفعل قال تدع الناس من الشر فإنها صدقة تصدق بها على نفسك

البخاري 2518صحيح
Contents
Reference
Commentary
Ayat
Collection
Sahih Bukhari
Book
Emancipation of slaves
Chapter
Which slaves are best to free
Numbering
Darussalam 2518
Bukhari 2518