In terms of allegory, the ambiguity of the dream is what is really important, so yes I guess it is vital to your interpretation of the story. Hawthorne obviously left the dream up in the air for a reason.
When I teach \"Young Goodman Brown,\" though, it really doesn\'t make much difference to me whether it was a dream or not. The importance is the change that occurs in Brown. He is never able to really know for sure if the black mass in the woods was real or not. But it does cast a shadow over his life and cause him to die as miserable old man.
As long as my students can understand that it was Hawthorne\'s intention to leave the reader wondering if it all really happened or not, I am pleased. Of course, they take sides and argue them.
So if you\'re thinking Brown dreamed everything, what does that say about his guilt and his subconscious desires and fears? If it was real, what does that say about his fellow residents and his own history?
The important thing to learn the story is how Young Goodman Brown changes throughout the story. He leaves a naive, pure young man. However, in the woods he has his eyes opened to the hypocrisy around him. He even learns (or at least the reader does) about the true nature of his supposedly pious family (there is a reason the devil is so familiar to him). Instead of recognizing that humans have a capacity for evil and then doing something about it. Brown refuses to accept it and dies miserable.
Lets look at the two possibilities:
1) Young Goodman Brown has had a dream about the town he lives in. In that dream,he has gone off into the woods and met townspeople behaving in ways contradictory to their behavior in town. These people seem to be "evil" and certainly duplicitous. Because this is a dream of his own mind, a reader can assume that Brown has some of his own desires to act against his "beliefs" and that he wishes to be free of the restraints of his religion. However, assuming this is a dream he has taken seriously, he is so paranoid that he never again trusts anyone, including his own wife, and lives out his days in misery. This suggests the negative effects of extremist religions and the nature of humans to be suspicious.
2) Brown really does exprience the whole event. In this scenario, he is not the foolish character at all. He has been betrayed by the members of his community, has encountered evil in its purest form, and must live his life knowing that God's plan for humanity has gone astray. No matter what is preached, people can not be trusted. This reading is more pessimisstic, and the message is that humans are evil, and strict adherence to God's rule is the only saving grace.
What seems most important about the story is the effect that the events--whether dream or actual--have on the protagonist. At the end of the story he no longer has faith in terms of his relationship with his wife ( with that name) nor in terms of his religion. He "scowled, and muttered to himself, and gazed sternly at his wife, and turned away . . . and his dying hour was gloom." This happens because he cannot trust people anymore after seeing--or thinks he has seen--their evil side. Despair in the goodness of God, Christians are told, is the worst of all sins, and that, perhaps, is what leads him to his doom.