Since this is a dissimilar metal weld (DMW) you will need to use either one of the two weld rods - 309 for service temperatures at or below 800 deg F, or Inconel 82/182 (depending on process) for service temperatures above 800 deg F.
The 4140 steel will be difficult to weld because of the carbon content (0.40% by mass). You will most likely need to use elevated preheat and PWHT, which would affect the corrosion performance of 316L base material. So, consider buttering the 4140 steel side of the weld joint first using one of the two electrodes mentioned above, PWHT the 4140 buttered material and then complete the rest of the weld joint to 316L using either electrode with no final PWHT.