From useradd -h you get
-p, --password PASSWORD encrypted password of the new account
To create the encrypted password you can use the Perl crypt() function
crypt($text, $salt)
So you can do
sudo useradd -m -p $(perl -e crypt("plaintextpassword", "salt") chosenusername
There is plenty results on the internet when you search for scripting useradd