If the file names of the input and output files use the same file pattern, you could try to sort them and load the pair in a Dataset.
On the other hand, if that’s not possible, I would recommend to create a lookup table (e.g. using a list of tuples, dict or any other container) to get the right file paths for the current index in the __getitem__ of your Dataset.