Teachers voted 281 to 13 to ratify a three-year contract with the Beverly Hills Unified School District, ending the threat of a strike today, the first day of school. The pact, which will cost the district an extra $1 million for wages and benefits, includes a 4% salary increase for the 1986-87 school year, a 3% wage increase and benefits increase in 1987-88 and at least a 3% salary increase in 1988-89. The average teacher's salary in Beverly Hills is currently $39,000. After the teachers, represented by the Beverly Hills Education Assn., ratified the contract, the Board of Education called an emergency meeting and unanimously approved the agreement. "Both sides were willing to compromise, and that's what collective bargaining is all about," board President Betty Wilson said.