The invention relates to dihydroisoquinoline compounds and an application of the dihydroisoquinoline compounds for preparing antibacterial agents for plants. The dihydroisoquinoline compounds have remarkable bacteriostatic activity on various phytopathogens. The dihydroisoquinoline compounds disclosed by the invention have the molecular structure characteristics shown as follows, wherein R1, R2, R3, R4, R5, R6, R7, R8, R9, R10, R11, and R12 are same or different groups, such as hydrogen, alkyl, cycloalkyl, alkenyl, alkinyl, unsaturated monocycloalkyl, alkoxyl, halogen, hydroxyl, nitryl, cyano, trifluoromethyl, heterocyclic substituent, carboxyl, ester group, acylamino, acyl or aldehyde group; and X<-> is sulfate radical, halogen anion, carbonate radical, bicarbonate radical, phosphate radical, hydrophosphate radical, acid radical of fatty acid, sulfonate radical or tetraphenylborate radical.