How to disable the comment for a specific node programmatically?
In D8, the comments are stored as field containing various comment properties including comment status.

You can disable node/entity comments using something like below:

use Drupal\comment\Plugin\Field\FieldType\CommentItemInterface;

/**
 * Implements hook_comment_insert().
 */
function [MODULE_NAME]_comment_insert($comment) {
  // Get comment field name, default comment.
  $field_name = 'comment'; // $comment-&gt;getFieldName();

  // Get entity.
  $node = $comment-&gt;getCommentedEntity();
  $node-&gt;get($field_name)-&gt;status = CommentItemInterface::CLOSED;
  $node-&gt;save();
}