ENOfficial
Ibn ‘Umar told that when the Prophet (ﷺ) heard the sound of thunder and of thunderbolts he said, "O God, do not kill us with Thine anger and do not destroy us with Thy punishment, but preserve us before that happens." Ahmad and Tirmidhi transmitted it, the latter saying that this is a gharib tradition.
Source: sunnah.com
Other translations
Arabic
وَعَنِ ابْنِ عُمَرَ أَنَّ النَّبِيَّ صَلَّى اللَّهُ عَلَيْهِ وَسَلَّمَ: كَانَ إِذَا سَمِعَ صَوْتَ الرَّعْدِ وَالصَّوَاعِقَ قَالَ: «اللَّهُمَّ لَا تَقْتُلْنَا بِغَضَبِكَ وَلَا تُهْلِكْنَا بِعَذَابِكَ وَعَافِنَا قَبْلَ ذَلِكَ» . رَوَاهُ أَحْمَدُ وَالتِّرْمِذِيُّ وَقَالَ: هَذَا حَدِيثٌ غَرِيبٌ
sunnah.com