International Business Machines Corp.'s first-quarter profit rose 5.2 percent from a year earlier, despite the adverse affects on foreign operations of inflation and a stronger dollar, the company said yesterday.

Meanwhile, CBS Inc. said its first-quarter profits from continuing operations were down 22 percent from a year ago because of big drops in revenue for its recorded music and musical instrument business.

And J. P. Morgan & Co. Inc. reported a 22 1/2 percent gain in first-quarter earnings.

IBM, the world's largest maker of data processing equipment and the eighth-largest U.S. industrial concern, said net income for the quarter rose to $768 million ($1.30 a share) from $730 million ($1.25) a year earlier as revenues climbed to $7.07 billion from $6.46 billion.

CBS said its first-quarter profits from continuing operations totaled $14.2 million (51 cents a share) compared with earnings of $18.2 million (65 cents) in 1981. Revenues rose by 3 percent in the quarter from $981 million to $1 billion.

J.P. Morgan & Co., whose Morgan Guaranty Trust Co. is the nation's fifth-largest commercial bank, said first-quarter profits before securities transactions were $99.5 million ($2.09 a share), while consolidated net income was $81.2 million ($1.92) in the same period a year ago.

Morgan attributed the year-to-year increase to improved net interest earnings of $294 million, up 25.1 percent from $235 million a year earlier.