How to enable template page only for a post id page

/**
    * Filters list of page templates for a theme.
    * @param string[]     $post_templates Array of template header names keyed by the template file name.
    * @param WP_Theme     $this           The theme object.
    * @param WP_Post|null $post           The post being edited, provided for context, or null.
    * @param string       $post_type      Post type to get the templates for.
*/

add_filter('theme_templates', function($post_templates, $this, $post, $post_type){
  // Unless post is 115, filter your custom template from the dropdown.
 if(!empty($post) && $post->ID != '150'){
    return array_filter($post_templates, function($template_name){
        return $template_name !== 'your_template_name';
    });
  }
  return $post_templates;
}, 20, 4);