The Scrum Master can assign the user stories, but generally it’s a conversation with the team. As in the whole team, reviews and assigns the user stories in their Sprint Planning session. The team as a whole has the best knowledge of who is an expert on what and can distribute the workload accordingly. But keep in mind that in Agile roles blur, so for example, just because there is a “Tester” or “Test Lead” in the Agile team it doesn’t necessarily mean that only that person will be doing testing. Other people in the team might be assigned a user story involving testing if they have the capability to perform the task.