When eating at family or friends homes

Hi, I’m not sure how to say no to food offered to me outside of my home that I don’t want to eat in a way that won’t offend my hosts especially in a situation where for example they may have prepared my favorite dish?