The Securities and Exchange Commission yesterday charged McCormick & Co., the Baltimore spice maker, with using an elaborate system of "false books and fictitious records" to inflate its sales and profits over a five-year period.

Repeating allegations made last spring by McCormick's own internal investigators, the SEC said McCormick not only made false reports to investors, but also "concealed its improper accounting by making false statements" to outside auditors.

Without admitting or denying the charges, McCormick agreed to abide by a federal court injunction prohibiting the company from violating SEC regulations.

McCormick Chairman Harry K. Wells issued a statement saying that "the settlement avoids costly and disruptive litigation" and noting that the company had already taken "various corrective measures."

The falsification of McCormick's profits was disclosed last May when the company issued a report saying an independent investigation by outside attorneys had uncovered padding of profits and sales by the grocery products division. The company at that time blamed the false reports on "overzealous" employes who inflated their performance to meet the sales and profits goals.

The SEC complaint filed yesterday in U.S. District Court provided no new details of the alleged accounting irregularities, but for the first time charged McCormick with violating federal laws.

The SEC said every quarterly and annual financial report issued by McCormick between December, 1976 and May 1981 was "false and misleading in that its net sales and net income were overstated in varying amounts." McCormick's 1980 profits were overstated by $1.6 million and sales for that year were inflated by $20.4 million, the complaint charged.

The SEC complaint said McCormick shifted income and expenses from one quarter to the next and from one fiscal year to the next to make its profits and sales appear larger than they actually were.

The company inflated sales by counting as "sold" merchandise that had been removed from shelves but not actually shipped to customers, the SEC said.

Similarly, McCormick delayed paying advertising allowances and other discounts due to customers from one quarter to the next, so those expenses did not have to be deducted from sales and profits, the SEC charged.

The SEC filed similar charges against David B. Michels, vice president and general manager of the grocery products division at the time the falsification of records occurred. Michels was forced off the McCormick board of directors last spring after the irregularities were disclosed, but remains head of the grocery division. Michels also signed a consent agreement in which he neither admitted nor denied the charges, but agreed not to violate the law.

The SEC complaint said McCormick President Hillsman B. Wilson was informed of the actions but "Wilson's response was along the lines of 'we need all we can get.' " Wilson was not charged in the SEC complaint.