Genesis 21:22 And it came to pass at that time, that Abimelech and Phichol the chief captain of his host spake unto Abraham, saying, God is with thee in all that thou doest:
Abraham is living in the land of the Philistines. They see him. They know him. They can tell that God is with him.
So that means that they know who God is. They have seen what God can do.
The two peoples have a relationship. Abimelech and Phichol have see what God can do and know that He is God.
Later these people will reject God and hate Him. We will see judgment. My first reaction is to think that God isn’t being fair but that isn’t the case at all. Abraham is there among them. They see and know about God. They could believe themselves.
They will reject God and choose their false gods over the God of Abraham. They will reject God and do things that are horrible in the eyes of God. Then God will judge them.
Maybe that helps us understand how God operates.