How to delete attribute group by id Magento 2?

You can remove the attribute group by the group id in Magento 2.

You can see a list of attribute groups from the Stores -> Attribute -> Attribute Set -> Click on Any attribute set.

Remove Attribute Group Record by the delete method with group id as an argument in the ProductAttributeGroupRepositoryInterface.

<?php
namespace Jesadiya\RemoveAttributeGroup\Model;

use Exception;
use Magento\Catalog\Api\ProductAttributeGroupRepositoryInterface;

class RemoveAttributeGroup
{
    /**
     * @var ProductAttributeGroupRepositoryInterface
     */
    private $productAttributeGroup;

    public function __construct(
        ProductAttributeGroupRepositoryInterface $productAttributeGroup
    ) {
        $this->productAttributeGroup = $productAttributeGroup;
    }

    /**
     * Delete Product Attribute Group By Id
     *
     * @return bool
     */
    public function removeAttributeGroup()
    {
        $isDeletedProductAttributeGroup = false;
        $groupId = 1;
        try {
          $isDeletedProductAttributeGroup = $this->productAttributeGroup->delete($groupId);
        } catch (Exception $exception) {
          throw new Exception($exception->getMessage());
        }

        return $isDeletedProductAttributeGroup;
    }
}

Now Call the method,
echo $isRemoveAttributeGroupSuccess = $this->removeAttributeGroup();

Output:
Boolean