The competition of isovector and isoscalar pairing in A=18 and 20 even-even N≈Z nuclei is analyzed in the framework of the mean-field plus the dynamic quadurpole-quadurpole, pairing and particle-hole interactions, whose Hamiltonian is diagonalized in the basis in the L = 0 configuration subspace. Besides the pairing interaction, it is observed that the quadurpole-quadurpole and particle-hole interactions also play a significant role in determining the relative positions of low-lying excited 0+ and 1+ levels and their energy gaps, which can result in the ground state first-order quantum phase transition from J = 0 to J = 1. The strengths of the isovector and isoscalar pairing interactions in these even-even nuclei are estimated with respect to the energy gap and the total contribution to the binding energy. Most importantly, it is shown that although the mechanism of the particle-hole contribution to the binding energy is different, it is indirectly related to the Wigner term in the binding energy.