def METHOD_NAME(organisms: List[Organism]):
    """Builds a dataset with the samples associated with the given organisms"""
    dataset = {}
    filter_query = Q()
    for organism in organisms:
        filter_query = filter_query | Q(organisms=organism)
    experiments = Experiment.objects.filter(filter_query).prefetch_related("samples")
    for experiment in queryset_iterator(experiments):
        experiment_samples = experiment.samples.filter(
            organism__in=organisms, is_processed=True, has_raw=True
        ).values_list("accession_code", flat=True)
        dataset[experiment.accession_code] = list(experiment_samples)
    return dataset