From the context of the story, there is no definitive way to tell whether or not the events in the forest are a dream.
Had goodman Brown fallen asleep in the forest, and only dreamed a wild dream of a witch-meeting?
Be it so, if you will. But, alas! it was a dream of evil omen for a young goodman Brown.
"Be it so, if you will." This implies that it is open to interpretation. The reader must answer the question. Was it a dream? "Be it so, if you (reader) will." It is quite persuasive that it is a dream, based on the following line:
A stern, a sad, a darkly meditative, a distrustful, if not a desperate man, did he become, from the night of that fearful dream.
However, whether it is in the form of a dream or in reality, what Brown "sees" is the potential for evil in the world. That is, he "sees" this evil in reality or as a vision/dream. It is irrelevant whether it comes in the form of dream or reality. The significant thing is that Brown "sees" the potential for evil.
There are other indications in the story that illustrate the fine line between dream and reality. In the opening paragraphs, Brown comments on Faith and how dreams influence reality:
'What a wretch am I, to leave her on such an errand! She talks of dreams, too. Methought, as she she spoke, there was trouble in her face, as if a dream had warned her what work is to be done to-night.
One of the aspects of this story is that dreams, visions, and intuitions can influence reality and vice versa. In fact, a dream might reflect something about reality. In that case, even if the journey through forest is a dream, it might reflect an aspect of reality or it might suppose something that is yet to be. Whether or not it is a dream is irrelevant because Brown would interpret the same thing from either: a revelation, notably a very pessimistic one, about evil.