Distinguishing standard and modified gravity cosmologies with machine learning