You could try using a repellent spray or a motion-activated deterrent, such as a device that emits a high-pitched sound or a motion-activated sprinkler. You could also try using a tall, sturdy gate or fence to keep the dog away from the tree. You could also use positive reinforcement, such as giving the dog treats and praise when it stays away from the tree. Finally, you could try training the dog to stay away from the tree by using a command, such as "no" or "stay away."