How can I programmatically disable Gutenberg query block patterns?

You can disable all “experimental block patterns” including the query block patterns by adding a filter:

add_action( 'init', function() {
  add_filter(
    'block_editor_settings_all',
    function ($editor_settings) {
      $editor_settings['__experimentalBlockPatterns'] = [];
      return $editor_settings;
    }
  );
});

You can see all editor settings (that you could disable with this filter) in this comment: https://developer.wordpress.org/reference/hooks/block_editor_settings_all/#comment-5661