The invention discloses application of a pityriacitrin alkaloid and a derivative thereof in resisting plant viruses and pathogenic bacteria, and relates to a biocide of the pityriacitrin alkaloid containing a 1-acyl substituted beta-carboline skeleton and the derivative thereof, in particular to twenty pityriacitrin alkaloids and derivatives thereof which are used as a plant virus resisting agent and a plant pathogenic fungus killing agent, the application as the plant virus resisting agent means use for tobacco mosaic virus, pepper virus, rice virus, tomato virus, sweet potato virus, potato virus, melon virus and maize dwarf mosaic virus, and the application as the plant pathogenic fungus killing agent means use for inhibiting 15 plant pathogenic bacteria such as cucumber fusarium wilt, rice blast, peanut brown spot, apple ring rot, wheat sheath blight, corn Bipolaris maydis, watermelon anthracnose, rice malignant seedling, tomato early blight, wheat gibberella, potato late blight, phytophthora capsici, sclerotium of rape, cucumber botrytis cinerea and rice sheath blight.