Since Nintendo shut down the original Wi-Fi Connection servers years ago, fans created Wiimmfi. melonDS supports this flawlessly. In melonDS, go to Config -> Wi-Fi Settings.
Version Matching: For local multiplayer to work between two instances of melonDS, both users should ideally be using the same version of the emulator. Setting Up Local Multiplayer (Ni-Fi) melonds multiplayer download
Ensure the "Direct Mode" or "Indirect Mode" is configured based on your network setup. Since Nintendo shut down the original Wi-Fi Connection