Cancer cells characteristically consume glucose through Warburg metabolism1, a process that forms the basis of tumour imaging by positron emission tomography (PET). Tumour-infiltrating immune cells also rely on glucose, and impaired immune cell metabolism in the tumour microenvironment (TME) contributes to immune evasion by tumour cells2-4. However, whether the metabolism of immune cells is dysregulated in the TME by cell-intrinsic programs or by competition with cancer cells for limited nutrients remains unclear. Here we used PET tracers to measure the access to and uptake of glucose and glutamine by specific cell subsets in the TME. Notably, myeloid cells had the greatest capacity to take up intratumoral glucose, followed by T cells and cancer cells, across a range of cancer models. By contrast, cancer cells showed the highest uptake of glutamine. This distinct nutrient partitioning was programmed in a cell-intrinsic manner through mTORC1 signalling and the expression of genes related to the metabolism of glucose and glutamine. Inhibiting glutamine uptake enhanced glucose uptake across tumour-resident cell types, showing that glutamine metabolism suppresses glucose uptake without glucose being a limiting factor in the TME. Thus, cell-intrinsic programs drive the preferential acquisition of glucose and glutamine by immune and cancer cells, respectively. Cell-selective partitioning of these nutrients could be exploited to develop therapies and imaging strategies to enhance or monitor the metabolic programs and activities of specific cell populations in the TME.