This is expected behavior when you have an element with dynamic ID. In such cases you have a few options to proceed.
You can try finding a parent element or a sibling element with unique attribute and try locating the button based on that element. You can used the so called chained find logic. More information you can find using this article
If the approach above doesn't work you can use blind mouse click
in order to press the button. Please note that the proper work of the blind mouse click can be dependent on the resolution. Thus if you are executing your test on multiple machines the behavior may be inconsistent.
Lastly, if the button is focused/active at the moment the dialog appears you can use a coded step to pres Enter for example and see whether this works. Here is an article
about how to use keyboard strokes.