Amid the spectral atmosphere, Hamlet obliges his friend Horatio and the guards to maintain silence about the ghost because he does not want any knowledge of its appearance to reach anyone in the court of Claudius; in addition, Hamlet does not know at this point if the ghost is honest with him.
After Hamlet departs, one of the officers named Marcellus declares the famous line, "Something is rotten in Denmark" (1.4.20). Now, after he has spoken to the ghost of his father, Hamlet realizes that things are, indeed, rotten in the royal court. So, he suspects Claudius, of course--"that incestuous, that adulterate beast"(1.5.42). He also mistrusts his mother--that "pernicious woman"(1.4.105)-- who so quickly married her husband's brother. Further, he really does not know who else may have been involved in the murder of his father, King Hamlet, or even whether the ghost is honest with him.
Therefore, he considers it wise that no word of his father's ghost, which could be from either purgatory or hell, be mentioned. As the play progresses, it becomes clear that Hamlet wishes to find evidence that supports what his father's ghost has told him before he acts.