Most state and federal courts have held that judges can consider uncharged crimes and even acquitted charges at sentencing. It follows that most courts allow judges to consider dismissed charges as well.
Judges generally have the discretion to consider a wide variety of factors when sentencing criminal defendants. In most states, the judge isn't bound by all the rules of evidence that apply during trial. The result is sentences that are partially based on information that wouldn't be admissible at trial and that hasn't been proven beyond a reasonable doubt. This can come as quite a shock to a defendant who has had a charge dismissed either before trial or as part of a plea bargain, only to hear the judge mention that charge as a factor in determining the sentence.
Federal sentencing law goes so far as to say that "[n]o limitation shall be placed on the information concerning the background, character, and conduct of a person convicted of an offense which a court...may receive and consider for the purposes of imposing an appropriate sentence." (18 U.S.C. § 3661.) Although courts have held that the information must be reliable. (U.S. v. Heckel, 570 F.3d 791 (7th Cir. 2009).)
Despite judges' wide latitude at sentencing, some states have set limits on considering dismissed charges. Among these limits are those providing that judges can't factor in dismissed charges if:
Even states that limit judges' consideration of dismissed charges may still let a sentence stand if the judge had other valid reasons for imposing it. Generally, higher courts won't overturn a judge's sentence unless it results from an "abuse of discretion." So, even if the judge improperly considered a dismissed count, an appeals court probably won't overturn it if the judge gave other, proper justifications for the sentence.
Criminal sentencing is one of those areas of law that differs greatly between federal and state courts, as well as from state to state. Only an experienced attorney familiar with the laws of your jurisdiction can properly advise you about the pros and cons of going to trial or agreeing to a plea. A criminal defense lawyer can effectively represent your interests at each stage, including sentencing, and determine whether you have a viable challenge to a judge's sentence.