Dogs scratch their beds before lying down because of instincts inherited from wolves. They mark territory with pheromones, regulate temperature, and create a comfortable nest. If your dog does this excessively, it might signal stress or boredom worth discussing with a vet.
Your dog also scratches the bed before going to bed like a madman. He doesn't do it on a whim or because he hates you and wants to destroy his sleeping area. The reason is much simpler. It's his natural animal instinct. This habit comes from his wild ancestors such as wolves who scratch the ground to make a more comfortable nest, remove stones, branches or bugs and prepare a safe place to rest. In addition, when they scratch they release pheromones from their pads, marking the spot with their scent. It's their way of saying I sleep here. They may also do it to regulate the temperature, especially if the bed is too cold or too hot. Now if you notice that he does it obsessively or harmfully it may be due to stress or boredom and it's his way of releasing energy. In these cases it's best to consult a veterinarian. Let us know in the comments if your dog scratches the bed before going to sleep. And until next time, experts.