Usually, data is preserved. I can’t really recall something like that happening to me. But when there are more fundamental changes done to the app’s folder structure for example, things might get erased.
Magic Dosbox has twp options when you’re setting up the data directory, public and private. Private will survive an uninstall of the app, but on the other hand, might get deleted as junk folder by some cleaning apps (never run those anyway, they can destroy important data). When you use the “public” option, the folder will be safe from cleaning apps, but deleted when you uninstall Magic Dosbox.