Whirlpool oven heats at start but does not maintain temperature.

Can anybody help and explain what is causing this problem. Whirlpool oven model wfg361lvq1. serial#R01856389. When using the bake setting on the oven, the oven reaches the temp that is selected at digital display. When it is time for the oven to restart and maintain temp, the igniter starts, the burner comes on and shuts off after a couple of seconds. other times the burner will not ignite at all. the igniter is working as it should. If i cancel the bake cycle at control panel, wait 1 minute and restart it burner comes back on and reheats to temp that is selected. stove top and brolier operates correctly. could this be the gas/safety valve gone bad? If so can anyone explain how to trouble shoot it? why would the stove top and brolier work okay as well?

I have a similar problem with a whirlpool gas range. The range lights and starts to heat when the temperature is set and I push “start”, but shuts itself off while heating up and won’t bake anything. The broiler works. Sometimes it beeps as it shuts off. It is model wfg320m0bb0