Why would the audience understand Hamlet's father as perhaps being the devil given the religious climate of Shakespeare's day?From Shakespeare's Hamlet
This feels like a little bit of a stretch to me, but I suppose it could be explained according to some of the beliefs about spirits or things that would appear to some people. Because the ghost has only appeared to Hamlet and in some cases he speaks to it (for example in Gertrude's bedroom) and others cannot see it, it is interpreted as a symptom of his madness. But if you were to subscribe to the religious beliefs of the time and suggest that Hamlet was possessed by an evil spirit, you could make the argument that his madness is in fact that possession and the spirit in this case is the devil.
In the scene where he chases the ghost and it speaks to him, Horatio and Bernardo suggest that it might in fact be an evil spirit and might tempt him to his own destruction. In this case again it could be suggested that the apparition could be the devil as the ghost of his father would certainly not do anything that could lead to him committing a sin such as suicide.
As I wrote earlier, it does feel like a bit of a stretch but could be argued and supported with a few scenes from the play.