I need to setup a ssh server that way, that it will accept password authentication only when there is no key added. So when a new user is created he can copy his key by password-based authentication.
It is not possible with pure openssh. But you might be able to make it working using PAM. Conceptually, you should be able to
/etc/pam.d/sshd a line with
password required pam_exec.so /usr/bin/test -s ~/.ssh/authorized_keys
I didn't test it, but you should be able to make up missing bits, if some.