Failing a summer class I was supposed to transfer

I’m a sophomore in college who was planning on taking linear algebra at my local community college. However, my teacher is insanely difficult, the only two kids who are currently passing the course are engineering majors who go to Cornell, and around half of the kids have withdrawn from the class. I did everything I could(reading, redoing homework, math learning center) and I’ve taken math courses at my state school and I’ve never had this much trouble with them. So my question is, should I withdraw from this class or could I just fail it? I am planning to retake the class at my state school, but it would be good just to finish the class as a review and fail or I could withdraw. Either option it would not show up on final state school transcript and therefore would not affect my gpa. However, I’ve heard that when you apply to grad school (which I plan to do) they want to see all official transcripts. I’m afraid that if I fail it would affect my going to grad school, so any advice would be great.