Desperately but unsuccessfully

Solution 1:

I'm not entirely sure why you feel desperately, but unsuccessfully doesn't read well. It flows naturally for me.

However, if you need a single word that represents the two things, try quixotically:

[Merriam-Webster, from quixotic]

: foolishly impractical especially in the pursuit of ideals
especially : marked by rash lofty romantic ideas or extravagantly chivalrous action

Further:

If you guessed that quixotic has something to do with Don Quixote, you're absolutely right. The hero of the 17th-century Spanish novel El Ingenioso Hidalgo Don Quijote de la Mancha (by Miguel de Cervantes) didn't change the world by tilting at windmills, but he did leave a linguistic legacy in English. The adjective quixotic is based on his name and has been used to describe unrealistic idealists since at least the early 18th century.

Nobody is perfect, so the desperation of trying to prove oneself to be a representative of that ideal matches the ill-advised fervour of Don Quixote in his fights against windmills as he tried to be the paragon of chivalry.

In your sentence:

He is quixotically trying to prove that he is perfect.