Python login system for a dice game
One guiding principle in software development is Don't Repeat Yourself (DRY). Your code for player 1 and 2 are almost identical, so you should extract them into a login function:

import crypt

class AuthenticationError(Exception):
    pass

def encrypt(word, salt):
    # use some one-way hashing function here
    return crypt.crypt(word, salt)

def login(users, max_tries=3):
    for i in range(max_tries):
        username = input("Please enter your username ")
        password = input("Please enter your password ")
        if username in users and encrypt(password, username) == users[username]:
            print("You are logged in as", username)
            return username
        else:
            print(f"Login failed. You have {max_tries - i - 1} tries left.")
    raise AuthenticationError(f"You have been locked out please restart to try again.")


This uses a hashing function, like @ChadG suggested in their answer, with a salt to prevent rainbow table attacks.

By raising an Exception (here a custom one, to give it a nice name), the execution of the program is automatically halted, so no need to explicitly do sys.exit.

This code assumes that you have read the users file before into a dictionary (only need to do it once!), something like this:

import re

def get_users(file_name):
    line_fmt = re.compile(r'username: (.*) password: (.*)')
    with open(file_name) as f:
        return dict(line_fmt.match(line.strip()).groups() for line in f)


Or, this slightly expanded version which ensures that the entries not conforming to the format are skipped (including any trailing newline):

def get_users(file_name):
    line_fmt = re.compile(r'username: (.*) password: (.*)')
    users = {}
    with open(file_name) as f:
        for line in f:
            try:
                name, password = line_fmt.match(line.strip()).groups()
                users[name] = password
            except AttributeError:
                print("Malformed line:", line)
        return users


Use it like this:

if __name__ == "__main__":
    registered_users = get_users("accountfile.txt")

    print("Could player 1 enter their username and password")
    player1 = login(registered_users)

    print("Could player 2 enter their username and password")
    player2 = login(registered_users)

    # start dice game


This uses a if __name__ == "__main__": guard to allow importing from this script from another script.