Well you said dataset1 has 100 images and dataset2 has 100 images xd
import torch
from torch.utils.data import Dataset


class ImgDataset(Dataset):
    def __init__(self, *args):
        do_your_stuf(*args)

    def __len__(self):
        return ''

    def __getitem__(self, idx):
        return load_img()


class PairDataset(Dataset):
    def __init__(self, dataset1, dataset2):
        self.dataset1 = dataset1
        self.dataset2 = dataset2

    def __len__(self):
        # Choose a criteria, assumen len1 = len2
        return len(self.dataset1)

    def __getitem__(self, idx):
        inputs1, inputs2 = self.dataset1[idx], self.dataset2[idx]

        return [torch.stack([x, y], dim=1) for x, y in
                zip(inputs1, inputs2)]  # This stacks all the tensors retourned by dataset


def train()
    dataset = PairDataset(ImgDataset(*args1), ImgDataset(*args2))
    dataloader = ...(dataset)

    for tensors in dataloader:
        tensors = [x.view(-1, *x.shape[2:]) for x in tensors] # You are converting Batch,[im1,im2],... into 2*Batch,...

If dataset1 and dataset 2 has different lengths you will have to fix it somehow (maybe repeating samples or whatever)
If you need to shuffle you can create a fake list of indices over the real one. Like:
class ImgDataset(Dataset):
    def __init__(self, *args):
        do_your_stuf(*args)
        self.indices = list(range(len(self)))
        shuffle(self.indices)
    def __len__(self):
        return ''

    def __getitem__(self, idx):
        real_idx = self.indices[idx]
        return load_img(real_idx)