import pandas as pd from datasets import load_dataset dataset_remote = load_dataset("imagefolder", data_dir="/tmp/data") for id in dataset_remote["test"]["id"]: out.append(dict(id = id, pred = "flux")) pd.DataFrame(out).to_csv("submission.csv",index = False)