I am trying to run a python script on a remote server which i dont trust. The script contains a password that is kind of important.
What would be a good way to protect that code/password?
I would give it as an argument or i could prompt input on the terminal but that would be saved in history.
Store password with code on untrustworthy server, that definitely unsafe. You have to change the way like below if you can.  

on the server you control, encrypt password with pub_key

general the different pub_key/private_key every request

the client you don't trust get id and encrypt_msg with auth
the password_required server get the id and private_key and decrypt encrypt_msg from client and compare the password.
delete the auth if the client is useless any more.
Protect python code including a password, encrypt?