Is mixing ketamine and mdma safe to do?

No. Please do not use ketamine at all. It is only a safe drug inside a hospital setting.
No. Ketamine is safe in the hands of licensed , experienced professional who has appropriate monitoring and resuscitation equipment. Do not try it at home. Mixing it with another drugs increases risk of death if not done in the professional medical setting.