Generally speaking, Halacha permits cooking on Yom Tov. However, the Ben Ish Chai (Rabbi Yosef Chayim of Baghdad, 1833-1909) ruled that it is forbidden to cook on Yom Tov food that one is himself unable to eat. For example, an Ashkenazi may not cook rice on Pesach for a Sepharadi. Since Ashkenazim are accustomed not to eat rice on Pesach, an Ashkenazi may not prepare rice for a Sepharadi. Similarly, the Rama (Rabbi Moshe Isserles, author of glosses to the Shulchan Aruch, Poland, 1525-1572) held that a person who observes on Yom Tov a Ta'anit Chalom (a fast in response to an unsettling dream) may not cook for others. Since it is forbidden for him to partake of any food, he may not cook, even for other people.
By the same token, the Ben Ish Chai held that after eating meat on Yom Tov, one may not cook dairy foods for the next six hours. Since he is presently barred from eating dairy products, it is forbidden during this period to cook such foods. Another example involves food that one cannot eat for medical reasons. A diabetic, for example, who must abstain from certain sweet foods, may not, according to the Ben Ish Chai, prepare such foods on Yom Tov for others.
Chacham Ovadia Yosef, however, in his work Halichot Olam, disagrees. Based on the position of the Chid"a (Rabbi Chayim Yosef David Azulai, Israel, 1724-1806), Chacham Ovadia distinguishes between the case of a person who observes a Ta'anit Chalom, and the other situations mentioned. In the case of a Ta'anit Chalom, the individual is barred from eating altogether, and it therefore stands to reason that he may not cook on Yom Tov. In the other situations, however, where one will not eat the food due to a medical condition or personal custom, or because he is temporarily forbidden from eating meat, he is allowed to partake of, and hence prepare, other foods. Hence, once he is allowed to cook certain foods, it seems reasonable to assume that he is then permitted to cook all other foods, as well, including foods from which he must abstain for personal reasons.
Thus, it is permissible on Yom Tov to cook even foods that one will personally not eat for either medical or Halachic reasons.