How I can create a user programatically using user registration form? How I can create a user programatically in drupal 8. I am using the following code to generate user registration form. 

$account = $this-&gt;entityTypeManager-&gt;getStorage('user')-&gt;create([]);
$form = $this-&gt;entityFormBuilder-&gt;getForm($account, 'register');


and form_sate values using the following code.

$form_state = (new FormState())-&gt;setValues(['name' =&gt; 'user1', 'pass' =&gt; 'pass']);


Now how can submit this form using the above form_state values?
I think you needn't use the registration form as you have mentioned. You can use the following code to create a new user:

if (!user_load_by_mail('email_id')) {
  $language = \Drupal::languageManager()-&gt;getCurrentLanguage()-&gt;getId();
  $user = \Drupal\user\Entity\User::create();

  //Mandatory settings
  $user-&gt;setPassword('your_password');
  $user-&gt;enforceIsNew();
  $user-&gt;setEmail('email_id');
  $user-&gt;setUsername('user_name'); //This username must be unique and accepts only a-Z,0-9, - _ @ .

  //Optional settings
  $user-&gt;set("init", 'email');
  $user-&gt;set("langcode", $language);
  $user-&gt;set("preferred_langcode", $language);
  $user-&gt;set("preferred_admin_langcode", $language);
  //$user-&gt;set("setting_name", 'setting_value');
  $user-&gt;activate();

  //Save user
  $result = $user-&gt;save();
}


You can ensure that an user with same email id doesn't exist using user_load_by_mail(), and then proceed with the user creation.