It depends on the MO diagram.
ORBITAL MIXING EFFECTS
B2 will experience orbital mixing, just like N2 and every homonuclear diatomic molecule on period 2 to the left of N2, where the σ2pz MO increases in energy and the σ2s decreases in energy relative to if there is NOT orbital mixing.
So, for B2, the σ2pz MO will be higher in energy than the π2px and π2py MOs, NOT lower!
As predicted, the σ2pz MO (labeled σg(2p)) is higher in energy than the π2px and π2py MOs (labeled as πu(2p)).
Notice the trend in how the σg(2p) MO has been moving upwards as we move from Ne2 to Li2; that is indicating that the orbital mixing is greater towards Li2, and becomes less than significant for O2, F2, and Ne2.
RATIONALIZING THE ELECTRON CONFIGURATION OF B2
Since boron contributes three valence electrons, two borons give a total of six valence electrons. So, the σ and π MOs generated by the 2s and 2p atomic orbitals in forming B2 will be filled with six valence electrons total.
Two fill the σ2s (labeled σg(2s)) and two fill the σ*2s (labeled σ*u(2s)). Finally, one electron goes in the π2px and the other goes into the π2py.
That accounts for all six valence electrons.
CONCLUSION
Therefore, B2 contains two unpaired electrons and is paramagnetic.
CHALLENGE: Had the πu(2p) MOs been higher in energy than the σg(2p) MO, B2 would have been diamagnetic. Why?