[It is not contradiction, first allah knows in advance that who will accept the truth.it is not bec allah sealed the the heart he cant understand the truth.but otherway around,,again i need to answer from first i hope, Suppose an experienced teacher, before the final examinations, predicts that a particular student will fail in the exams, since the student is very mischievous, not attentive in class and does not do his homework. If after the student appears for the examination, he fails, who is to be blamed for the student failing: the teacher or the student? Just because the teacher predicted, it does not mean that the teacher is to be blamed but the student himself is responsible for his failure.
Similarly Allah (swt) knows in advance that there are some people who are bent on rejecting the faith and Allah has put a seal on their hearts. Thus these non-Muslims themselves are responsible for rejecting the faith and not Allah (swt).
And even it doesnt stop us giving thawah to non believers, as Allah says in Quran call them to correct path.]
teachers only can predict whether the student failed or pass by checking his activitites but not once he look at him. so just like allah can only predict by looking at peoples activity that even acn be done by humans. so allah dont know the destination of a human when he give birth. thats means allah is not all known.
Of course he knew the activities even before his birth only, he predicted so.Human prediction may not be correct always as to whether some one will go to heaven or hell. human beings bound to make error.tht one of the exclusive character for humans.