In Gal.3 the gospel was preached to Abraham beforehand not after he was dead as 1 Peter 4:6 says. Both verses are independent of each other, in other words, the verses in Gal. 3 are related to Abraham while 1 Peter 4:6 is not.
“Just as Abraham believed God, and it was credited to him as righteousness. Therefore, recognize that it is those who are of faith who are sons of Abraham. The Scripture, foreseeing that God would justify the Gentiles by faith,
preached the gospel beforehand to Abraham, saying, “All the nations will be blessed in you.” So then, those who are of faith are blessed with Abraham, the believer.”
Galatians 3:6-9 NASB2020
Just as Abraham BELIEVED GOD, AND IT WAS CREDITED TO HIM AS RIGHTEOUSNESS. Therefore, recognize that it is those who are of faith who are sons of Abraham. The Scripture, foreseeing that God would just
bible.com
“For the gospel has for this purpose been preached even to
those who are dead, that though they are judged in the flesh as people, they may live in the spirit according to the will of God.”
1 Peter 4:6 NASB2020
For the gospel has for this purpose been preached even to those who are dead, that though they are judged in the flesh as people, they may live in the spirit according to the will of God.
bible.com