LeaveOneGoupOut uses the groups argument for the splitting as described in the docs:

groups: array-like of shape (n_samples,)
Group labels for the samples used while splitting the dataset into train/test set. This ‘groups’ parameter must always be specified to calculate the number of splits, though the other parameters can be omitted.

This groups argument is often used as an additional attribute of the dataset, e.g. in case you are dealing with different patients in a medical dataset and would like to avoid mixing samples from one patient into the training and validation dataset.
In your use case you are using the dataset.targets as the groups argument, so I would assume that you explicitly want to keep some targets only in the training dataset and others in the validation data (which would be uncommon).