I am sorry that you're stuggling with this right now. It sounds like you might be suffering from Imposter Syndrome is when we feel like we don't belong with our peers. In this case, you feel like you are not at the same academic level as your peers and as a result you feel like giving up.
As silly as it sounds, the best way to get over imposter syndrome is to try to stop comparing yourself to others. If you are working hard and demonstrating that you are trying then it doesn't matter if you are the top student, the average student or the bottom student. Plus everyone has different expereinces in life so it's silly to equate your hardships with others or your accomplishments with other's.
I hope that helps. I know how debilitating imposter syndrome can be. It does get better when we stop comparing constantly.