Ikrima reported,

Ibn Abbas said to me and to his son Ali, "Go to Abu Saeed and listen to his hadith."So we set out, and we found him tending to a walled garden of his. He took his cloak, wrapped it around himself while sitting with his knees drawn up, and began narrating to us until he came to mention the building of the mosque. He said, "We were carrying the bricks one by one, while Ammar was carrying two at a time. The Prophet ﷺ saw him and began wiping the dust off him, saying, 'Alas for Ammar! A rebellious faction will kill him. He calls them to Paradise, and they call him to the Fire.'"He said that Ammar would say, "I seek refuge in Allah from trials."

Bukhari 447

Sahih

حدثنا مسدد قال حدثنا عبد العزيز بن مختار قال حدثنا خالد الحذاء

عن عكرمة قال

لي ابن عباس ولابنه علي انطلقا إلى أبي سعيد فاسمعا من حديثه فانطلقنا فإذا هو في حائط يصلحه فأخذ رداءه فاحتبى ثم أنشأ يحدثنا حتى أتى ذكر بناء المسجد فقال كنا نحمل لبنة لبنة وعمار لبنتين لبنتين فرآه النبي ﷺ فينفض التراب عنه ويقول ويح عمار تقتله الفئة الباغية يدعوهم إلى الجنة ويدعونه إلى النار قال يقول عمار أعوذ بالله من الفتن

البخاري 447صحيح
Contents
Reference
Commentary
Ayat
Collection
Sahih Bukhari
Book
Prayer
Chapter
Cooperation in building the masjid
Numbering
Darussalam 447
Bukhari 447