According to the docs target_transform should be callable. Assuming you know the number of classes in advance, something like this should work:
def target_to_oh(target: int) -> List[int]:
    NUM_CLASS = 5  # hard code here, can do partial
    one_hot = [0] * NUM_CLASS
    one_hot[target] = 1
    return one_hot

# Use here
ds = ImageFolder('some/path', target_transform=target_to_oh)

I didn’t try it. May have some errors but conceptually should work