Sahih al-Bukhari, Book 56, Hadith 228 (In-Book)

Narrated Abu Hurairah (ra): I heard Allah's Messenger saying, "An ant bit a Prophet amongst the Prophets, and he ordered that the place of the ants be burnt. So, Allah inspired to him, 'It is because one ant bit you that you burnt a nation amongst the nations that glorify Allah?"

حَدَّثَنَا يَحْيَى بْنُ بُكَيْرٍ، حَدَّثَنَا اللَّيْثُ، عَنْ يُونُسَ، عَنِ ابْنِ شِهَابٍ، عَنْ سَعِيدِ بْنِ الْمُسَيَّبِ، وَأَبِي، سَلَمَةَ أَنَّ أَبَا هُرَيْرَةَ ـ رضى الله عنه ـ قَالَ سَمِعْتُ رَسُولَ اللَّهِ صلى الله عليه وسلم يَقُولُ ‏ "‏ قَرَصَتْ نَمْلَةٌ نَبِيًّا مِنَ الأَنْبِيَاءِ، فَأَمَرَ بِقَرْيَةِ النَّمْلِ فَأُحْرِقَتْ، فَأَوْحَى اللَّهُ إِلَيْهِ أَنْ قَرَصَتْكَ نَمْلَةٌ أَحْرَقْتَ أُمَّةً مِنَ الأُمَمِ تُسَبِّحُ اللَّهِ.‏" ‏‏‏

sunnah.com