Will use the Centurion CNT-1D aerospace fighter as an example.
Go to your MegaMek/data/images/units folder and open mechset.txt and localserver_mechset.txt.
In mechset.txt use Control+F to find the original unmodified fighter you are looking for. In the case for the Centurion you may need to hit find next or previous to make sure you have the correct one. Will look like the below line with a "fighter/centurion.png", instead of "mechs/centurion.png".
exact "Centurion CNT-1D" "fighter/centurion.png"
Copy that line and paste in localserver_mechset.txt at the bottom on a new line.
Close mechset.txt.
The rest will be done to the line pasted in localserver_mechset.txt
If it begins with chassis instead of exact, change to exact.
Now change the first item in quotation marks to that of your custom unit's designation, as an example "Centurion CNT-1CDAT". Must exactly match what is shown when you look at it in Megamek. The second set of quotation marks is the path to the folder and the image file name from the folder mechset.text is in.
exact "Centurion CNT-1CDAT" "fighter/centurion.png"
Save then close. Relaunch MegaMek to see if it worked.