In MediaWiki 1.31.1, the script maintenance/importImages.php ignores the option --dry-run and executes the import for real.
$ php importImages.php --dry-run --comment-ext txt ~/dir Import Images Importing myfile.jpg...done. $ php importImages.php --dry-run --comment-ext txt ~/dir Import Images myfile.jpg exists, skipping