First Virginia Banks Inc. yesterday announced plans to enter the Maryland suburbs of Washington by acquiring United Bancorp of Maryland in a stock swap worth $37.5 million.

The acquisition of the medium-sized holding company will add 12 banking offices in Maryland to the First Virginia group, giving it more than 100 banking offices in the Baltimore-Washington region. In June 1986, First Virginia purchased The Commercial Bank, gaining 10 offices in the Baltimore area.

United Bancorp is a one-bank holding company based in Upper Marlboro whose principal subsidiary is United Bank & Trust Co., a commercial bank with assets of $148 million. It has offices in Prince George's, Montgomery, Anne Arundel and Charles counties.

The transaction price is three times the book value of United Bancorp's stock -- at the high end of the 2.5 to 3 times book that has been paid for recent bank acquisitions.

Paul H. Geithner, president of First Virginia, characterized the acquisition as "an excellent fit" because of similarities in the two banks' management styles and loan profiles. "We both hold predominantly consumer loans and stick to conservative loan and investment policies," Geithner said.

United Bank and Trust will retain its name, directors and management, and operate as a separate bank within the First Virginia group, officials said.

First Virginia Banks Inc., based in Falls Church, has assets of $4.2 billion.

The acquisition, which is subject to regulatory approval, is expected to be completed by the end of August. It will give the First Virginia group 22 banks in Virginia, Maryland and Tennessee.