Ruling on offering the funeral prayer for the deceased before the imam does so
Question

I am the mu’adhdhin of a mosque. There is another mosque nearby where they offer the funeral prayer. Between the adhan and iqamah, I go and offer the funeral prayer for the deceased, seeking the reward of one qirat. What is the ruling on offering the funeral prayer for the deceased before the imam does so – in other words, before the (scheduled obligatory) prayer? Please note that if I go after the prayer, I usually get there when they have finished the funeral prayer.
Praise be to Allah.The Sunnah is to offer the funeral prayer with the congregation.
An-Nawawi (may Allah have mercy on him) said: It is permissible to offer the funeral prayer individually, but the Sunnah is to offer it in congregation, because of the hadith: “There is no Muslim who dies and three rows of Muslims offer the funeral prayer for him, but it is due.” And there are other famous hadiths in as-Sahih regarding that, as well as the consensus of the Muslims. The larger the congregation is, the better.
End quote from Sharh al-Muhadhdab, 5/173.
For more information, please see the answer to question no. 152888.
If a person is unable to join the funeral prayer with the first congregation, in this case it is permissible for him to offer the funeral prayer for the deceased before the imam does so, and it is also permissible for him to offer the funeral prayer for the deceased at the graveyard, before the burial.
Shaykh `Abd ar-Rahman al-Barrak (may Allah preserve him) said: … Thus it becomes clear that there is no reason to prevent those who hasten to offer the funeral prayer out of eagerness for reward, as they are not able to wait to pray with the imam and the congregation, even though that is better for them. And Allah knows best. End quote.
Shaykh Yusuf ash-Shubayli (may Allah preserve him) was asked: Is it permissible for someone to offer the funeral prayer by himself before the imam does so, when the funeral prayer is to be offered at the time of `Asr, but he comes and offers the funeral prayer for the deceased at the time of Zuhr?
He replied: If the bier is present in the mosque at the time of Zuhr prayer and he wants to offer the funeral prayer for the deceased, because he is not able to attend the funeral prayer after `Asr, there is nothing wrong with that, although it is better to pray with the congregation. If there is a number of people who can offer the funeral prayer in congregation with him [at the time of Zuhr], that is better, but if there is no one else except him, there is nothing wrong with him offering the prayer on his own, because it is not stipulated in order for the funeral prayer to be valid that it should be done after the imam of the mosque has led an obligatory prayer.
End quote from Burnamaj al-Jawab al-Kafi.
Based on that, it is permissible for you to offer the funeral prayer for the deceased before the imam does so, because of the excuse that you have mentioned.
And Allah knows best.