Seventeen years ago, District Photo Inc., a three-year-old string of camera shops, "went public" by selling 100,000 shares of stock at $5 each.

Yesterday the founder of the 20-year-old, $40-million-a-year business bought out the public toockholders, paying $116.25 for every original $5 investment.

The $1 million transaction merged District Photo into Cohen Family Corp., which is owned by Melvin S. Cohen, president of District Photo, and his relatives. Shareholders of the Beltsville company approved the transaction at a final shareholders meeting yesterday.

Under terms of the merger the approximately 240 public shareholders will receive $31 for each of the 375,000 shares now in public hands.

Since District Photo's original public offering, there have been several stock splits that over the last 17 years gave investors 3.75 shares for each of the original shares. Each original share has yielded $9.65 in dividends, producing a total gain of $125.90 on the original investment.

The growth of that investment reflects the changes in District Photo's business since Cohen founded the company in 1959.

Originally District Photo was a film processing company -- printing snap shots for amateur photographers -- and operated the camera departments in the now-defunct Gem discount stores.

From that base grew a chain of 16 Snap Shops camera stores, a nationwide photo processing service that is one of the biggest in the business, and a number od drive-in photofinishing kosks carrying the names Mr. Foto and Kwik Foto.

Cohen, who founded the company, has remained its principal stockholder and with members of his family owned 65 percent of the stock earlier this year. Another 10 percent of the shares were owned by District Photo board members who agreed to back the merger.

Under District of Columbia law, the vote of two-thirds of the shareholders of a company is needed to approve a merger. As a concession to minority shareholders Cohen's offer to buy back the stock required approval by 75 percent of the stock not owned by the Cohen family.

When the votes were counted yesterday, only 1,893 shares were voted against the merger; 95 percent of the public stock was voted in favor of the transaction offer.

For several years, District Photo has operated in one of the nether-worlds of the investment market. It was a public company, with shares traded over the counter, but because it had less than 300 shareholders it was not required to make reports to the Securities and Exchange Commission. The stock changed hands infrequently, local brokers said, with the bid price moving from around $7 a share in 1976 to $15 to $20 a share last year.

In March, Cohen began his efforts to buy out the public shareholders, making a $24 per share offer for the stock. That offer was raised to $28 on the recommendation of the company's outside directors.

Cohen's plans ran into a snag last spring when owners of about 31,000 shares objected to the offer and hired the investment banking firm of Furman, Selz, Mager, Dietz & Birney to evaluate the stock.