The old saying, "If you fall of the horse(in this case bike) get right back on."
Go back to where your crash happend and ride it. If you were jumping or doing a drop, find smaller ones and work your way back up to the one that you wrecked on. If it was from to much speed, go to that section, ride it slow, go back up and do it again a bit faster, about 10 times or until you feel relaxed again.
Dreaming of a crash will always happen. From little crashes to all out yard sales.
Try to picture what you did wrong in you head and think, " What should I do differantly?".
Hope you get over your fear quickly and get back to ridin'.
Slainte