An automatic peritoneal dialysis machine comprises a dialyzate bag, a heater, a waste liquid bag, a safety detector, a first valve, a second valve and a third valve. Dialyzate in the dialyzate bag is heated to the set temperature through the heater, the first valve and the second valve are opened, the third valve is closed, the heated dialyzate flows into an abdominal cavity of a patient, when the pouring amount of the dialyzate reaches the preset value, the first valve is closed, the dialyzate stays in the abdominal cavity of the patient to conduct dialysis and diffusion, when the time that the dialyzate stays in the abdominal cavity of the patient reaches the preset time, the first valve and the third valve are opened, the dialyzate exchanged in the abdominal cavity is led out of the waste liquid bag, and after the amount of the led-out dialyzate is consistent with the amount of the poured dialyzate, the first valve and the third valve are closed. The safety detector leads out the dialyzate exchanged in the abdominal cavity and conducts blood leakage detection on the dialyzate exchanged in the abdominal cavity. The machine effectively ensures the safety state of the patient in the dialysis process, and improves the dialysis efficiency.