Context. Submillimeter spectroscopic observations of comets provide an important tool for understanding their chemical composition and enable a taxonomic classification. Aims. We aim to determine the production rates of several parent-and product volatiles and the 12 C/ 13 C isotopic carbon ratio in the long-period comet C/2004 Q2 (Machholz), which is likely to originate from the Oort Cloud. Methods. The line emission from several molecules in the coma was measured with high signal-to-noise ratio in January 2005 at heliocentric distance of 1.2 AU by means of high-resolution spectroscopic observations using the Submillimeter Telescope (SMT) at the Arizona Radio Observatory (ARO). Results. We have obtained production rates of several volatiles (CH 3 OH, HCN, H 13 CN, HNC, H 2 CO, CO, and CS) by comparing the observed and simulated line-integrated intensities. We calculated the synthetic profiles using a radiative transfer code that includes collisions between neutrals and electrons, and the effects of radiative pumping of the fundamental vibrational levels by solar infrared radiation. Furthermore, multiline observations of the CH 3 OH J = 7-6 series allow us to estimate the rotational temperature using the rotation diagram technique. We find that the CH 3 OH population distribution of the levels sampled by these lines can be described by a rotational temperature of 40 ± 3 K. Derived mixing ratios relative to hydrogen cyanide are CO/CH 3 OH/H 2 CO/CS/HNC/H 13 CN/HCN = 30.9/24.6/4.8/0.57/0.031/0.013/1 assuming a pointing offset of 8 due to the uncertain ephemeris at the time of the observations and the telescope pointing error. Conclusions. The measured relative molecular abundances in C/2004 Q2 (Machholz) are between low-to typical values of those obtained in Oort Cloud comets, suggesting that it has visited the inner solar system previously and undergone thermal processing. The HNC/HCN abundance ratio of ∼3.1% is comparable to that found in other comets, accounting for the dependence on the heliocentric distance, and could possibly be explained by ion-molecule chemical processes in the low-temperature atmosphere. From a tentative H 13 CN detection, the measured value of 97 ± 30 for the H 12 CN/H 13 CN isotopologue pair is consistent with a telluric value. The outgassing variability observed in the HCN production rates over a period of two hours is consistent with the rotation of the nucleus derived using different observational techniques.