You can link an account by tapping Menu then Account Management on the title screen or Misc., then Account Management, then Create/Link a Nintendo Account.
Note: If you do not have a Nintendo Account, please see What is a Nintendo Account?
1. Open the Account Management menu from the Menu on the title screen or by tapping Account Management in the Misc. menu on the home screen.
2. Tap Create/Link a Nintendo Account.
3. Input your email address and password to log in. If you have already signed in to your Nintendo Account, tap "Select this account".
Note: Double check the Nintendo Account being displayed carefully before performing this step.
For instructions on how to transfer your save data, see How do I transfer my save data? (When changing to a new device, etc.)