I am not aware than one can keyframe material assignment.
I think you would have to do something like create a geonode that assigns the material, assign all of those materials to a list, then key frame the list index.
All this sounds more difficult and involved than how I would do it. And instead of clicking 300 materials in Blender, now you’re just clicking 300 pictures to look through.