Due to sp hybridization shown by Be in BeH2, the molecule BeH2 is linear. Though the individual Be-H bonds are polar (due to difference of electronegativity) yet BeH2 has a dipole moment of zero as dipole moment is a vector quantity (it has both magnitude and direction).
The individual polar character of Be-H bond cancels out as the dipoles are equal and opposite as shown below:
