True greatness cannot be hidden behind mere ordinariness. Some subjects are so pervasively great that no film, given a certain level of intelligence on the part of the people who make it, can fail to catch something of the essence.

Such a subject is Mohandas K. Gandhi (1869-1948), the great Indian political leader who used nonviolent resistance to win the Indian subcontinent's freedom from the British Empire, and who lived to see that dream split in the partition of India and Pakistan.

On independence day in August 1947, when someone used the word ''congratulations,'' Gandhi is reported to have said that condolences would be more in order. Six months later, Gandhi, who was born a Hindu but who preached the brotherhood of men under one God, was assassinated in Delhi by a Hindu fanatic. His is one of the great stories of modern times.

''Gandhi,'' produced and directed by Richard Attenborough (''Oh! What a Lovely War,'' ''Young Winston''), is a big, amazingly authentic-looking movie, very sincere and aware of its reponsibilities in the panoramic manner of a giant post office mural. It has huge, rather emotionless scenes of spectacle that are the background for more or less obligatory historical confrontations in governors' palaces and, best of all, for intimate, small-scale vignettes from Gandhi's life. The film follows him from his days as a young lawyer in South Africa, through the evolution of his political activism and asceticism, until his death at the age of 79.

''Gandhi,'' which opens today at the Ziegfeld Theater, is most effective when it is being most plain and direct, like Gandhi himself. In Ben Kingsley, the young Anglo-Indian actor who plays the title role, the film also has a splendid performer who discovers the humor, the frankness, the quickness of mind that make the film far more moving than you might think possible.

Mr. Kingsley, a member of London's Royal Shakespeare Company, looks startlingly like Gandhi. But this is no waxworks impersonation. It's a lively, searching performance that holds the film together as it attempts to cover nearly half a century of private and public turmoil.

Neither Mr. Attenborough nor John Briley, who wrote the screenplay, are particularly adventurous film makers. Yet in some ways their almost obsessively middle-brow approach  their fondness for the gestures of conventional biographical cinema  seems self-effacing in a fashion suitable to the subject. Since Roberto Rossellini is not around to examine Gandhi in a film that would itself reflect the rigorous self-denial of the man, this very ordinary style is probably best.

''Gandhi'' is least effective when it is dealing with historical events and personages, especially British personages, who are portrayed by such as John Gielgud, Edward Fox, John Mills, Trevor Howard and Michael Hordern. Some of them come very close to being cartoons, the sort of Englishmen who are always identified by having either a teacup or a whisky glass in hand. The people who play Lord Mountbatten, India's last viceroy, and Lady Mountbatten look remarkably lifelike but sort of stuffed.

Somewhat better are the Indian actors who play Pandit Nehru (Roshan Seth), Mohammed Ali Jinnah (Alyque Padamsee) and Gandhi's wife, Kasturba (Rohini Hattangady). Athol Fugard, the South African playwright, has one brief, effective scene as General Smuts. Ian Charleson of ''Chariots of Fire'' has a small part as one of Gandhi's early English supporters, and Martin Sheen turns up from time to time as an American newspaper reporter. Candice Bergen is on hand at the end as Margaret Bourke-White, the Life magazine photographer.

Though ''Gandhi'' is long  more than three hours  it is full of scenes that catch the emotions by surprise. Among them are the funny, bitter sequence in which Gandhi is booted out of his firstclass railroad seat in South Africa, a suddenly angry encounter with his wife when she haughtily refuses to clean the latrines at an ashram, and a scene in which Gandhi basks in the adoration of Margaret Bourke-White and threatens to teach her how to spin.

Also moving is an early scene in South Africa when Gandhi, long before he adopted the loincloth as his only dress, beams proudly at his small, immaculately tailored sons. ''I'm so proud of them,'' he says. ''Perfect little English gentlemen!''

The film portrays the political events from 1915 until independence in broad, ''You Are There'' style, sometimes with real dramatic impact, as in the protests over the government's salt monopoly, but sometimes perfunctorily, considering the awful nature of the events. This is particularly true of the film's handling of the Amritsar massacre of 1919 when British troops were ordered to fire on hundreds of unarmed Indians.

Considering its length, ''Gandhi'' should probably be allowed its small share of silly lines. Gandhi: ''Who's that fellow?'' Friend: ''Young Nehru. He may amount to something some day.'' These are small lapses but they shouldn't happen in a film project that was undertaken  as this one was by Mr. Attenborough  as a special mission.

Of more overall importance is the possibility that the film will bring Gandhi to the attention of a lot of people around the world for the first time, not as a saint but as a self-searching, sometimes fallible human being with a sense of humor as well as of history. ''I have friends,'' he says to Margaret Bourke-White at one point, ''who are always telling me how much it costs to keep me in poverty.''

''Gandhi,'' which has been rated PG (''parental guidance suggested''), contains a few essential scenes of brutality.

GANDHI

Directed and produced by Richard Attenborough; written by John Briley; directors of photography, Billy Williams and Ronnie Taylor; film editor, John Bloom; music by Ravi Shankar; released by Columbia Pictures. At the Ziegfeld Theater, 54th Street between Avenue of the Americas and Seventh Avenue. Running time: 200 minutes. This film is rated PG.