It is real my friend..
who told you that Hamlet is hallucinating?!..
he suspect in himself and in his mind but he never halluciate..
this link will help you in analyzing this play..
Interested in Language
Hamlet by William Shakespeare
The credibilty of the ghost:
Is the ghost real or not?
How is it unreal and how is it merely Hamlet's hallucination, although it is seen by Horatio, Francisco, Bernardo, and Marcellus?
it is real
There are basically two possibilities:
(1) It's about Hamlet.
(2) It's about the Ghost.
If it's about Hamlet, there are two major ways to interpret it: First, Hamlet is actually mad (this is a strained and almost certainly incorrect interpretation of the play, but it is widespread). Second, as a previous answerer pointed out, Hamlet has not come to terms with his father's death but Gertrude has -- that may be integral to his ability to see the Ghost. (However, it's unlikely that the watchmen in Act I are conflicted about the old king's death and they have no problem seeing it.)
If it's about the Ghost, then the primary answer is "it's magic, it can do whatever it wants". In the scene (and his original meeting with Hamlet), the Ghost specifically tells Hamlet that he doesn't want Gertrude to be distressed. Seeing the ghost of your dead husband would probably distress you, so there's your motivation for the Ghost choosing not to reveal itself to her.