Consider setting up the document as a template for Photoshop variables. This would involve:
- A Pixel Replacement variable layer for an image.
- A Text Replacement variable layer for the caption.
- A separate spreadsheet file with the data set, where each row has the path to each image file in one column, and the caption text in the next column.
If it works properly, Photoshop should be able to assemble 400 versions, each with its image and caption.