Hide the ‘Gallery Settings’ section of the Gallery tab of the media Thickbox

David, I’m not sure if you’re trying to disable the whole gallery (plus the settings) or only its fields. For the first option, you should try do deregister the admin-gallery script:

function disable_gallery() {
    $post_id = (int) $_GET['post_id'];

    // Check for your post / page ID
    if( $post_id == 343  ) {
        wp_deregister_script( 'admin-gallery' );
    }
}

add_action( 'admin_enqueue_scripts', 'disable_gallery' );

error code: 523