I've had a lot of teachers that do this, they pick favourites they like the kids that show up and participate with the class... When there is someone off or sort of hiding away they either think something is horribly wrong and strange with them or think they're a "bad apple"
I think a lot of teachers from my childhood forgot how to be objective with they're grading, picked favourites and made excuses for why they would give one kid a bad mark and the other a better when they both put in the same amount of effort.
I had a friend who went to university and the attitudes did not change, she left pretty quickly when it was clear they would not grade her well solely because she would not get up in front of the class and play "show and tell" to everyone with her artwork.
I have a story: Once I had a team project for Spanish class in high school, I went over to my partners house and spent a whole week working on this thing... We handed it in and I remember getting an F for it, and my partner had gotten an A.
I went up and asked her what happened, why did my partner get more than me... The teacher didn't even know what project I had worked on. I pulled her over to it (it was a massive poster board display) and said "This one! We spent a lot of time on this!" she looked at me and said "it can't be yours, your name isn't on it"
I looked and low and behold my name was not on it, there was my partners name with a small dot under it as if she had started to write but stopped. I looked at my teacher and said "You know who you partnered together and I was put with her, you know it's ours even go ask her."
The teacher refused to believe me or pursue the subject, even worse was the partner did not step forward even after confronting her about it she made an excuse "I asked you how to spell your name and you never told me so I forgot to write it, sorry"
I was furious. MY artwork was all over that poster board, and she claimed it as her own work. I was graded a fail on that project and she got all the credit, I was clearly one of the "bad apples" simply because I was an artist and I drew on my jeans. I felt dejected like nobody would believe what had happened if I went to the principal, so I didn't even bother.
Sorry... This subject is still really touchy for me, I hate this school system to it's core.
I think attendance is necessary, but if you hand in all your homework and show you are understanding the subject material then what is the problem? Maybe you need to be put in advanced classes is the only thing I can think of really...
And participation? I feel like being put in front of a class where you have to speak your presentation to everyone is nerve wracking. I knew kids who would go into a panic if they had to and end up failing because they wouldn't do it. In that case why wouldn't the teacher look they're project over separately and grade them based on this, or maybe just having a session with only the teacher and student where the kid does his presentation to them so it's less terrifying for them...
There are other examples I could use and obviously like participating in doing labs in science is an important part of learning that subject. It depends on the situation to me...