I think I am a failure.
Why do you think you're a failure?
Even though I'm in the top 10%, I still doubt I will be able to graduate
Do not call yourself a failure. It will lead to a worse performance from you. There is no way you cannot graduate being top 10% in your class.
Everyone is a failure, who says you can't be a failure with a degree? I'm also going to fail as a failure.
Thoughts like that will begin to take permanence, even if you know they are not true. Find something to take pride in so you do not think you are a failure.