Hamlet was worried that this ghost was coming to tempt him into murder. Imagine if you saw ghost that told you to go kill your uncle; that's pretty weighty stuff there. Murder is not to be taken lightly. Hamlet didn't want to just jump up and immediately go kill someone because a ghost told him to. Plus, in Shakespeare's time, ghosts were often considered omens of evil that was about to happen; so, Hamlet was naturally superstitious about the ghost. So, because of this, Hamlet decides to be very careful about enacting revenge. He wants to see whether or not Claudius is actually guilty first, through more solid proof than a ghost's word, a ghost who could be "goblin damn'd" bringing "blasts from hell" who has "intents wicked" (I.iv.40-42). All Hamlet is saying is that maybe the ghost is bad and evil, come to prompt him to murder. Hamlet wants to check it out first, before acting.
When Hamlet says, "the devil hath power to assume a pleasing shape", he is interpreting a verse from the Bible that says "for even Satan disguises himself as an angel of light."( II Corinthians 11:14). During Elizabethan times, ghosts were thought of as evil spirits. This belief is echoed by Horatio when he warns Hamlet not to follow the ghost at the beginning of the play. He says:
What if it[ the ghost] tempt you toward the flood, my lord,(75)
Or to the dreadful summit of the cliff
That beetles o'er his base into the sea,
And there assume some other horrible form,
Which might deprive your sovereignty of reason
And draw you into madness?
Act I, Scene IV, Lines 75-80
Thus Hamlet calls the ghost the devil because that was a common belief at the time.
It was an evil spirit because of his evil attempts...you cannot be a soul in purgatory(as the ghost claims it comes from) cleansing your sins to enter heaven, as the dictionary defines it, and ask to avenge Claudius. Back then, people based their life decisions on their heavy christian influence. Therefore, everyone knew that Jesus taught to love and forgive your enemies- something the ghost completely contridicted. Evidently, I believe the ghost presented in Hamlet is an evil spirit.
The reason why Hamlet say that the ghost was a devil was becouse of his Protestant believe which can be found in act one, scene two
"If it assume my noble father's person, I will speak to it, "
the word it mean the ghost which show his Protantism believe. Protestant only believe that the soul will only got to heaven or hell and not roaming on earth, on evil spirit roam the earth with evil intention.