I just want to say, I think its awesome that you're even interested in theology at your age. I didn't even k ow what omniscience meant at your age lol.
First, as stated before, God created time and space, and is outside of both. He can see all of history at once, he's not trapped inside of time like us. Nothing has or will happen that he's not aware of already.
I think what has you confused is thinking that, first, because things may look to you or me like they went wrong, or didn't go according to plan (people becoming evil, resulting in the judgement of the flood) God didn't know it was going to happen in the first place or that it wasn't his plan all along. And second, that because Abraham had to choose whether or not to proceed with the sacrifice of his son, that God must not have known what Abraham would do.
Just because there may be different possible outcomes to a situation (Abraham), or just because it seems to us that God could have prevented something from happening and it wasn't what he wanted, doesn't mean that's the case.
Think of the cross. First, something seemingly terrible happening (God, in Christ, being wrongfully executed as a criminal) was exactly according to God's plan, and it was actually the greatest thing that has ever happened in all of history. Also, the Jews reaction to Jesus, Judas's betrayal, Pilate's involvement, the trial of Jesus, His sentencing. All of these events could have went another way, and seem to be left up to the human's decision, but God was in control the whole way, guiding everything to happen according to His plan.
It's one of the greatest mysteries of the Bible, and of the nature of God and Man (human free will / God's providence or guiding of history), but somehow, while it seems like history is determined only by the decisions of men, God is actually guiding things according to His plans.
Stay in the word, young friend. Once you grow in your knowledge of scripture, you will see it will begin to answer itself.