Is your duck injured?
Does your duck have plenty of food and water?
Is your duck acting out of fear?
Were you giving your duck treats after biting had started?
If a duck who doesn't normally bite has begun to bite and display abnormal behavior, it might be injured and in pain. If you suspect this might be the case, take the duck to a veterinarian for an examination.
Birds sometimes bite to get your attention and let you know that they need something. If a duck isn't receiving a proper diet, it may start to act aggressively.
A loud sound or other animals may have scared your duck and it started acting aggressively to defend itself. If this is the case, try to either prevent this stimulus from scaring the duck by removing it or by conditioning the duck not to fear it.
Don't give your duck a treat to warm it up to you after it bites you. The duck will understand this as a reward and will continue the biting behavior. Similarly, don't walk away immediately after it bites you. This will cause the duck to know if it bites you, you will leave.
Birds sometimes bite to establish dominance over people. Your first instinct might be to yell or scream and pull away, but you should refrain from doing so. Don't react with yelling or pulling away when your duck bites you. Train your duck to do a simple trick, such as coming when called. Training it a trick will teach the duck that you are the dominant one.
https://www.cuteness.com/article/teach-duck-not-bite

Sreten null
Hi! I’m Sreten Filipović. I graduated from the Faculty of Agriculture at the University of Belgrade, with a master's degree in Environmental Protection in Agricultural Systems. I’ve worked as a researcher at Finland's Natural Resources Institute (LUKE) on a project aimed at adapting south-western Finland to drought episodes. I founded a consulting agency in the field of environment and agriculture to help farmers who want to implement the principles of sustainability on their farms. I’m also a founding member of the nonprofit organization Ecogenesis from Belgrade whose main goal is non-formal education on the environment and ecology. In my spare time, I like to write blog posts about sustainability, the environment, animal farming, horticulture, and plant protection. I’ve also published several science-fiction short stories.
You can find me on LinkedIn at https://www.linkedin.com/in/sreten-filipovi%C4%87-515aa5158/