You can either use an "array formula" like this

=AVERAGE(IF(B1:J1=3,B2:J2))

confirmed with CTRL+SHIFT+ENTER

or this "regular" formula will give the same result

=SUMIF(B1:J1,3,B2:J2)/COUNTIF(B1:J1,3)