That's a legitimate question, one theologians have debated for years. An intriguing study if you have that interest.  Short answer, we believe God is just & merciful, & while He has not revealed exactly how that would work, there are passages in the Bible that indicate He's got that figured out and the plan is fair. We're told that people who lived before Christ but believed in the Hebrew God (Abraham, Moses, David) are judged based on what they did with the knowledge they had & were given salvation based on the faith they showed.  We're told that those who were not given specific revelations about God did have knowledge of a higher being & will be judged based on what they did with that.  Recorded interactions between Hebrews and non-Hebrews in the Old Testament indicate this, & many systems of deities known from secular history also indicate this kind of knowledge.

I'm not trying to convert you :-) just trying to answer your questions.  I wish you well, also.