I am using extendscript with Photoshop, but when the version mismatch happens, Photoshop pops up a dialog

I just want it to keep the layers and proceed. How do I tell Extendscript to do that?
I am using extendscript with Photoshop, but when the version mismatch happens, Photoshop pops up a dialog

I just want it to keep the layers and proceed. How do I tell Extendscript to do that?
I'd have to see the code you're using to understand why the dialog appears. However, one way around this is to call Photoshop events directly with the app.executeAction() call. The optional third argument is how you want dialogs to be handled; one of the choices you can pass in is DialogModes.NO to suppress them.
In order to understand how to create the Photoshop events, you can use the ScriptingListener plugin to see the events generated for various operations. Here's an old introduction to it. You can download the plugin from here.