Ray A. Kroc, the builder of the McDonald's hamburger empire, who helped change American businiess and eating habits by deftly orchestrating the purveying of billions of small beef patties, died yesterday in San Diego. He was 81 years old and lived in La Jolla, Calif. Mr. Kroc, who also owned the San Diego Padres baseball team, died of a heart ailment at Scripps Memorial Hopsital in San Diego, a McDonald's spokesman said. At his death he was senior chairman of McDonald's. Mr. Kroc, a former piano player and salesman of paper cups and milkshake machines, built up a family fortune worth $500 million or more through his tireless, inspired tinkering with the management of the McDonald's drive-ins and restaurants, which specialize in hamburgers and other fast-food items. He was a pioneer in automating and standardizing operations in the fiercely competitive, multibillion-dollar fast-food industry. He concentrated on swiftly growing suburban areas, where family visits to the local McDonald's became something like tribal rituals. He started his first McDonald's in Chicago in 1955 and the chain now has 7,500 outlets in the United States and 31 other countries and territories. The total systemwide sales of its restaurants were more than $8 billion in 1983. Three-quarters of its outlets are run by franchise-holders. Richard G. Starmann, a vice president and spokesman, said at McDonald's headquarters in Oak Brook, Ill., that 1983 was a profitable year for the company, which is the United States' largest food service organization in sales and number of outlets. What made Mr. Kroc so successful was the variety of virtuoso refinements he brought to fast-food retailing. He carefully chose the recipients of his McDonald's franchises, seeking managers who were skilled at personal relations; he relentlessly stressed quality, banning from his hamburgers such filler materials as soybeans. Mr. Kroc also made extensive, innovative use of part-time teen-age help; he struggled to keep operating costs down to make McDonald's perennially low prices possible, and he applied complex team techniques to food perparation that were reminiscent of professional football. After McDonald's had made him a major figure on the business scene, Mr. Kroc became influential in the sports world by buying the San Diego Padres for $10 million in 1974. The new and eager team owner was notably outspoken: After the Padres made three errors and a costly base-running blunder in a 1974 game against the Houston Astros, he used the San Diego Stadium public address system to tell the team's fans, "I suffer with you; I've never seen such stupid ball playing in my life." In the major leagues of American business, Mr. Kroc's career was unusual because its enormous success was so late in coming. He was in his 50's when he went into the hamburger business, making himself president of the McDonald's Corporation in 1955. In 1968 he became chairman, and he took the title of senior chairman in 1977, when McDonald's purveyed more than $3.7 billion worth of fast-food fare, outselling its archcompetitor, the Pillsbury-owned Burger King, by 4 to 1. McDonald's shares were a Wall Street favorite in the early 70's, before the bear market took hold. They reached a peak in January 1973 of around 77; investors who bought them when first offered in the mid-1960's had seen their wealth multiply more than sixtyfold. Over the years, Mr. Kroc was repeatedly involved in controversy. The authors Max Boas and Steve Chain charged in a 1976 book, "Big Mac: The Unauthorized Story of McDonald's," that McDonald's had exploited its employees by forcing them to take lie- detector tests and by appropriating their tips. The architecture of McDonald's outlets was sometimes criticized, as was the nutritional content of the food. But one critic, the nutritionist Jean Mayer, once said, "I am nonfanatical about McDonald's; as a weekend treat, it is clean and fast." In 1972 Senator Harrison A. Williams Jr., Democrat of New Jersey, suggested that there was a link between the more than $200,000 that Mr. Kroc had contributed to President Nixon's re-election campaign and the Nixon Administration's position on the question of teen-age wage limits, a matter of prime importance to McDonald's. And when, after a stormy stint in the baseball limelight, Mr. Kroc announced in August 1979 that he was giving up operating control of the Padres, he said, with typical crustiness, "There's a lot more future in hamburgers than in baseball. Baseball isn't baseball anymore." Mr. Kroc cut a commanding figure, his thin hair brushed straight back, his custom made blazers impeccable, his eyes constantly checking his restaurants for cleanliness. The bulky rings on his fingers glinted as he ate his hamburgers with both hands. "I guess to be an entrepreneur you have to have a large ego, enormous pride and an ability to inspire others to follow your lead," he once said. But his leadership entailed a wish that his followers be, like him, driven by an unending urge to build and to excel. "Some people reach their level of expectations pretty quickly," he once observed. "We want someone who will get totally involved in the business. If his ambition is to reach the point where he can play golf four days a week or play gin rummy for a cent a point, instead of a tenth, we don't want him in a McDonald's restaurant." Understandably, many McDonald's executives decorated their offices with scrolls inscribed with his favorite inspirational dictum: Nothing in the world can take the place of persistence.Talent will not; nothing is more common than unsuccessful men with talent.Genius will not; unrewarded genius is almost a proverb.Education will not; the world is full of educated derelicts.Persistence and determination alone are omnipotent. Mr. Kroc established the McDonald's headquarters in Oak Brook, a few miles from the Chicago suburb of Oak Park, where he was born Oct. 5, 1902, the son of an unsuccessful real estate man whose family came from Bohemia in what is now Czechoslovakia. Ray Albert Kroc went to public schools in Oak Park, but did not graduate from high school. In World War I, like his fellow Oak Parker, Ernest Hemingway, he served as an amublance driver. Then, after holding various jobs, he spent 17 years with the Lily Tulip Cup Company, becoming sales manager for the Middle West. But by 1941, "I felt it was time I was on my own," Mr. Kroc once recalled, and he became the exclusive sales agent for a machine that could prepare five milkshakes at a time. Then, in 1954, Mr. Kroc heard about Richard and Maurice McDonald, the owners of a fast-food emporium in San Bernadino, Calif., that was using several of his mixers. As a milkshake specialist, Mr. Kroc later explained, "I had to see what kind of an operation was making 40 at one time." "I went to see the McDonald operation," Mr. Kroc went on in a memoir published in The New York Times, and suddenly insights gained during his years in the paper-cup business and the milkshake machine business mingled fruitfully in his mind. "I can't pretend to know what it is--certainly, it's not some divine vision," he continued. "Perhaps it's a combination of your background and experience, your instincts, your dreams. Whatever it was, I saw it in the McDonald operation, and in that moment, I suppose, I became an entrepreneur. I decided to go for broke." Mr. Kroc talked to the McDonald brothers about opening franchise outlets patterned on their restaurant, which sold hamburgers for 15 cents, french fries for 10 cents and milkshakes for 20 cents. Eventually, the McDonalds and Mr. Kroc worked out a deal whereby he was to give them a small percentage of the gross of his operation. In due course the first of Mr. Kroc's restaurants was opened in Des Plaines, another Chicago suburb, long famous as the site of an annual Methodist encampment. Business proved excellent, and Mr. Kroc soon set about opening other restaurants. The second and third, both in California, opened later in 1955; in five years there were 228, and in 1961 he bought out the McDonald brothers. In choosing franchise owners to manage the new outlets, Mr. Kroc and his associates looked, as he explained it in 1971, "for somebody who's good with people, we'd rather get a salesman than an accountant or even a chef." Among the license holders they selected were a member of the House of Representatives from Virginia, a chemist, a golf professional, dentists, lawyers, advertising men and even a former Under Secretary of Labor. Under Mr. Kroc's persistent goading, McDonald's insisted that franchise owners run their own outlets. It also poured hundreds of millions of dollars into advertising--to the point where the head of another fast-food company said in 1978 that consumers were "so preconditioned by McDonald's advertising blanket that the hamburger would taste good even if they left the meat out." Mr. Kroc was also unremittingly intense in training his franchise owners at "Hamburger University" in Elk Grove, Ill., where a training course led to a "Bachelor of Hamburgerology with a minor in french fries." Instructors told new McDonald's owners how to clean grills, how to flip a hamburger and how to tell when one was done. "It starts turning brown around the edge." Mr. Kroc met his wife, Joan, in a restaurant in 1956 when he and she had other spouses. They were married in 1968, and she went on to found and become the head of Operation Cork, a national program to help the families of alcoholics. It started in 1976, financed by McDonald's revenues through the Kroc Foundation. Operation Cork's activities included an $800,000 grant to the Dartmouth Medical School to frame a model curriculum for the study of alcohol misuse and alcoholism. Mr. Kroc suffered a stroke in December 1979 and soon afterward entered an alcoholism treatment center in Orange, Calif., because, he said at the time, "I am required to take medication which is incompatible with the use of alcohol." Mr. Kroc's survivors include his wife, Joan, of La Jolla; a brother, Dr. Robert Kroc of Santa Ynez, Calif.; a sister, Lorraine Groh of Lafayette, Ind.; a stepdaughter, Mrs. Linda Smith of San Diego, and four granddaughters. A memorial service is planned for Friday in Oak Brook.