It is customary to eat certain foods on Rosh Hashanah that allude to our wishes for a successful and pleasant year. Thus, for example, we have the practice of eating Lubia (black-eye peas), pomegranates, dates, leeks, apples and gourds on the first night of Rosh Hashanah; some have the practice of eating these foods on both nights of Rosh Hashanah.
This custom is based upon the Gemara’s discussion in Horiyot, where the Gemara affirms the significance of "Simanim," making allusions to our hopes for a favorable judgment. There are, however, two divergent texts of this Talmudic passage. According to one version of the text, the Gemara advises eating foods on Rosh Hashanah that express our hopes for a good year, whereas according to a different version, the Gemara speaks of simply looking at, rather than eating, these foods.
Based on these divergent texts, the Kaf Ha’haim (Rav Yaakov Haim Sofer, Baghdad-Israel, 1870-1939) ruled that one who cannot, for whatever reason, eat these traditional foods should point to them instead. One example is a person who discovers on the night of Rosh Hashanah that the pomegranates or dates are infested with insects and thus unsuitable for consumption. This Halacha would similarly apply to somebody who is allergic to, or simply does not like, one of these foods. In these cases, one should recite the traditional "Yehi Rason" prayer over the food in question and then point to that food, instead of eating it. In such a case, we may rely on the second version of the text of the Gemara cited above, according to which this custom involves looking at, rather than eating, these special foods.
Summary: A person who cannot, for whatever reason, partake of one of the special foods traditionally eaten on the night of Rosh Hashanah should recite the "Yehi Rason" prayer and then point to the food instead of eating it.