What is the term for discriminating against someone for something they're not?

Solution 1:

Try pigeonhole, defined by Merriam Webster as

To unfairly think of or describe (someone or something) as belonging to a particular group, having only a particular skill, etc.

Also see its definition by Cambridge dictionary : pigeonhole

to put someone or something into a group or type, often unfairly.