Two general equations govern the turbine:
1. Steady-State Energy Balance (ignoring kinetic and potential effects):
## \frac{\dot{E}}{\dot{m}} = \frac{\dot{Q_{t}}}{\dot{m}} - \frac{\dot{W_{t}}}{\dot{m}} + (h_{i} - h_{o}) = 0##
2. Steady-State Entropy Balance:
## \frac{\dot{S}}{\dot{m}} = \frac{1}{\dot{m}} \int \frac{\dot{\delta Q}}{T} + \frac{\dot{\sigma}}{\dot{m}} + (s_{i} - s_{o}) = 0##
Where ##\dot{\sigma}## is the rate at which entropy is generated by the turbine, and the integral is over the entire boundary of the turbine system. The lower case h and s variables represent the enthalpy and entropy of the fluid per unit mass, respectively. Let me know if you need clarification on any of the other symbols (stating them all is a pain).
There is no heat being added from the surroundings to the turbine (you're not igniting fuel or injecting heat from a hot reservoir into the turbine volume), so ##\dot{Q}## is only going to be zero or negative. If it's negative, that means you're losing energy that you would otherwise be getting off as heat (some of the work that the turbine could have made is instead being siphoned off as waste heat given to the surroundings). So for an ideal, maximum efficiency turbine, ##\dot{Q} = 0##. This gives you ##\frac{\dot{W}}{\dot{m}} = h_{o} - h_{i}##. Also, it tells you, based on the entropy balance, that ##\frac{\dot{\sigma}}{\dot{m}} = s_{o} - s_{i}##.
The second law tells you that entropy is never destroyed, so ##\dot{\sigma} \geq 0##. At this point, you can take it on faith that entropy generation kills efficiency. But if you want the mathematical proof, just consider the thermodynamic relation for the enthalpy per unit mass, ##h_{o} - h_{i} = \int_{p_{i}}^{p_{o}} v dp - \int_{s_{i}}^{s_{o}} T ds##. The enthalpy difference (which remember is what's driving your turbine output shaft power) is optimized when ##s_{i} = s_{o}##.
From what I've gathered, the parameters you have fixed are the inlet temperature (##T_{i}##), the outlet temperature (##T_{o}##), and the inlet pressure {##p_{i}##). Just to be on the safe side, let's assume that your outlet fluid could be a saturated liquid-vapor mixture. So now, there is a new unknown: the mass fraction of the vapor phase, a.k.a. the quality factor of the saturated mixture: ##x = \frac{m_{g}} {m_{g} + m_{f}}##.
Now you can write the outlet enthalpy and entropy in terms of the quality factor:
##h_{o} = xh_{g}(T_{o}) + (1-x)h_{f}(T_{o})##
##s_{o} = xs_{g}(T_{o}) + (1-x)s_{f}(T_{o})##
The inlet state is fixed by T_{i} and p_{i}, so you can get h_{i} and s_{i} from superheated ammonia vapor tables. Now you can do some algebra to solve for the quality factor of the outlet mixture by using the constraint that ##s_{i} = s_{o}## for a maximally efficient turbine.
##x = \frac{s_{o} - s_{f}(T_{o})}{s_{g}(T_{o}) - s_{f}(T_{o})} ##
With the quality factor, you can now find the outlet enthalpy from the 2-phase mixture equations above, and you're in business.
P.S.: If when you do this calculation, by some funky planetary alignment you find a quality factor of 1, then you will have hit the one in a million odds of accidentally designing an ideal turbine system that spits out pure saturated ammonia vapor. Similarly, if the quality factor turns out to be greater than 1, then you know what's coming out of the turbine is actually superheated vapor, and you can solve the problem instead by using the outlet temperature and outlet entropy to fix that outlet state. You'd just return to the superheated ammonia tables and use more linear interpolation to find a value of enthalpy for superheated ammonia vapor that gives the correct entropy and temperature.