It's wrong to aim only for fame.

Literal

Fame [only-だけ] [object-を] objective [dative-に] do [nominalizer-の] [topic-は] wrong [copula-だ].

目的にする = 'make X an objective.' The だけ ('only') narrows the focus to 'just fame.' A moralistic observation, probably from a character-development or ethical context.