I really don't know much about astrophotography, but don't modern Nikon cameras do in-camera dark-frame subtraction already? The camera calls it "long exposure noise reduction".
If you'd want to turn this off in camera and do it manually, then the dcraw
based method I suggested does really give you data which is suitable for this.
dcraw -o 0 -D -T -6 infile.nef
will create a TIFF that has un-demosaiced, unprocessed data. The pixel values will be proportional to the charge accumulated at each photosite. The TIFF you get will look like this (no. 2) due to lack of demosaicing.
You can then process it in Mathematica.
But I imagine that eventually you would want to export this data from Mathematica and do proper demosaicing on it. I don't know what tool will be able to do this well. I don't know of any easy way to put the processed data back into a NEF file so you can use Lightroom, ViewNX or other RAW converters that know the camera's characteristics and can do a correct conversion.
This is why I stopped playing with RAW data in Mathematica. I could do some useful processing on it (I wanted to do de-banding), but I had no way to convert this data to a usable photograph afterwards.