That's an awesome question! I do a lot of gardening myself and once thought about the same thing. I did some research about the health risks and found out that the only one is the possibility of getting roundworms which can easily be eliminated by composting.
So, yes! You can compost your dogs poop and fertilize edible plants with it but only if you compost it before usage as fertilizer.
How to propperly compost dog poop
Use 1 part sawdust and 2 parts dog poop. Throw it the composting pile and cover with plastic to keep warm. Turn the mix every couple of days to a week. After 6-8 weeks you will have a fertilizer safe enough to use on edible plants.
Nah. Dogs eat too many proteins. Their poop is acidic and is not a good fertiliser for plants in general. Using it may instead spread diseases due to the amount of bacteria that dog poop spreads.
I found an adticle with a lot of information about the topic: