You can find a lot of dissertations pretending to compare punishment for undesired behavior with reward for desired behavior to determine which is more effective as a motivator. Some of them even have some insightful things to say. But this whole framing is wrong, because punishment and reward are not alternatives.

Punishment as a motivator applies when the subject does what you don't want. Reward applies when they do what you do want. And the only difference between a punishment and the loss of a reward or between a reward and the escape of a punishment is the default state - if a slave is regularly beaten by their master, it functions as a reward when they don't get beaten. If a child is regularly given presents, it's a punishment when they don't get a present. In other words, the actual choice is not "to punish bad behavior or to reward good behavior", but "how generous to be in the first place". So it's not about which is more effective. It's about how generous you're going to be.

Of course there's the complication that punishment is often understood to mean something violent, but it doesn't have to mean that, and when it does, that's just adding an additional moral dimension that dilutes the question further beyond a question of effectiveness.