We should not pray for the dead unless God has asked us to do so. But from the Bible, I can’t remember any incident where God asked someone to pray for the dead.
The only thing God asked us to do to the dead is raise them. When Jesus was sending out the seventy two, He instructed them to heal the sick, cast out devils and raise the dead.
Some may argue that raising the dead is equivalent to praying for the dead but that is not true. When Jesus was raising Lazarus from the dead, He commanded Lazarus to come out.
That is different from making an intercession for a dead person.
The truth of the matter is that once someone dies, he is out of the influence of men. God has given us influence over the lives of others in that we can pray and make intercessions for them.
But once someone dies, he goes to the realm of the dead where our prayers are obsolete. It is only Jesus who has power in the realm of the dead because He alone overcame death.
Praying for the dead is a waste of time. It is wiser for us to focus on praying for the living so that when they die they are received in heaven rather than praying for the dead.
Praying for the dead is not a sin but it is foolishness. If foolishness is a sin, then praying for the dead only becomes a sin because it is foolish.
A mature believer in Jesus is not expected to be making foolish prayers for the dead. There are many wise things we are asked to pray for.
If you want to pray for the dead, raise them from the dead and then pray for them.