Is Hamlet primarily a tragedy of revenge?
The simplest answer to your question would be, "Yes, Shakespeare's Hamlet is primarily a revenge tragedy." That is definitely the simplest genre in which to categorize the play. The main thrust of the plot centers around Hamlet's seeking revenge for his father's "foul and most unnatural murder." His revenge strategy ultimately leads to the final classically tragic image of a room full of dead bodies.
But if Shakespeare's Hamlet were nothing more than a revenge tragedy, it would not be the celebrated play that it has been for so many centuries. Shakespeare's genius lies in how he transcends the typical revenge tragedy tropes.
He accomplishes this by creating one of the smartest, most thoughtful, and most complex characters in Western literature: Hamlet. Though spurred to vengeance by the ghost, to whom he swears that "from the table of my memory / I'll wipe away all trivial fond records /... And thy commandment alone shall live / Within the book and volume of my brain" (I.5.99-103).
After words like that, Hamlet must go straight and kill Claudius, right? Nope. Hamlet does not take the straight path to vengeance. His father's death, reappearance as a ghost, and the implications made against his uncle and mother plunge Hamlet into a deep spiritual and intellectual crisis that he must resolve before he can take his revenge.
He seriously considers what keeps people from taking action ("To be or not to be"); he wrestles with the indifference of Nature ("what is this quintessence of dust?"); he wonders at how humanity can be both the culmination of evolution and still so low ("what a piece of work is a man"); he fears for his soul and so seeks out more proof than the ghost's word ("the play's the thing"); and he confronts the betrayals of both his mother and his girlfriend.
In fact, it is not until halfway through Act IV that Hamlet's existential crisis resolves itself enough for him to finally focus on the task given to him in Act I and swear that "from this time forth / My thoughts be bloody or be nothing worth" (IV.4.65-6).
So, yes, Hamlet is a revenge tragedy, but what elevates it to brilliant literature is the character at the center of that revenge tragedy, and the inner battles he experiences in the face of the deed he knows he must do. In Hamlet, Shakespeare uses the tropes and elements of the revenge tragedy to explore some of the biggest questions in a person's life.