For undergraduate studies is it preferable to go the a prestigious school and get decent GPA or to go to not well known school but be top of the class?
Many good questions generate some degree of opinion based on expert experience, but answers to this question will tend to be almost entirely based on opinions, rather than facts, references, or specific expertise. If this question can be reworded to fit the rules in the help center, please edit the question.
Honestly, when I'm reading applications I barely notice either one. I don't have to look at GPA 99 times out of 100 because those below the minimum are screened out, and I don't care much about what school you went to because prestige schools have some crappy departments and low-prestige schools have some great ones, and I'm almost never going to know which is which.
I spend most of my app-reading time on the personal statement. Can you write? (Very important in my department; importance to others is obviously somewhat variable.) Can you tech? (Likewise.) Do you understand what you're getting yourself into, and have decent, non-clichéd, at least marginally realistic reasons you're doing it? Do you have skills or an educational or life background we're specifically looking to recruit? Relevant experience?
Go be a worthwhile person with a clue. That's what we're looking to admit, not shiny GPAs or fancy-schmantzy schools.