This idiom *dont judge the book by its cover is a metaphorical phrase which means you should not prejudge the value of something by its outward appearance alone.
*ex. There is a small restaurant in your town, you should'nt judge that restaurant unless you know the foods they are serving that might be more delicious than the huge and known restaurants in town.
This is why we should not form an opinion on someone or something based purely on what is seen on the surface, because after taking a deeper look, the person or thing may be very different than what is expected.
Judging a person does not define who they are... it defines who you are-so be always careful of what is you want to say to anyone because you do not know if that person is sensitive to some issues and it may affect their feelings. So consider their point of views to understand that person.