All dogs like to dig and some breeds like terriers really want to dig.
You can put a fine wire mesh or even chicken wire under the flower bed soil. Where you plant cut a hole in the mesh. Grass will actually grow and make the mesh disappear if you use it in a lawn area. The dog won't like the metal and will leave the garden alone.
Give the dog a place where he can dig - his own sand box. Encourage him to use this area by hiding treats and/or rewarding him when he uses it. If you see him in the flower bed gently correct him and lead him to the "sand box" and reward him for digging there.