The best remedy for a dog being constipated depends on the cause. For an overview of the various causes of constipation and the treatment options, I recommend going over this article:
https://pets.webmd.com/dogs/dog-constipation-causes-treatment
As discussed in the article, some potential remedies include a veterinary-prescribed high-fiber diet, laxative agents or stool softeners, adding canned pumpkin to the diet or prescription medications. However, without knowing the underlying cause, it is recommended to see a veterinarian as this will help you determine which treatment is appropriate, and if there is an underlying cause for your dog not defecating often enough as other illnesses can mask themselves as appearing to be from constipation. For more information to determine if your dog is truly constipated, I recommend this article:
https://www.vetbabble.com/dogs/questions-dogs/how-often-should-dog-poop/