It is called stereo typing and generalization. It is never good. It should be avoided by everybody.
You are right, its never good but doesnt it happen anyway? Like when you wear hijab and do something people around you generally dont do, people automatically start relating that action with your religion. Isnt that why Muslims in general have to be so careful about how they present themselves?